Lines Matching +full:fetch +full:- +full:depth
6 * @author i-net software <tools@inetsoftware.de>
11 if (!defined('DOKU_INC')) define('DOKU_INC', /** @scrutinizer ignore-type */ realpath(dirname(__FIL…
47 … $controller->register_hook('AJAX_CALL_UNKNOWN', 'BEFORE', $this, 'ajax_siteexport_provider');
48 $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'siteexport_action');
52 * AJAX Provider - check what is going to be done
59 if (!strstr($event->data, '__siteexport'))
64 $this->__init_functions(true);
66 switch ($event->data) {
67 case '__siteexport_getsitelist': $this->ajax_siteexport_getsitelist($event); break;
68 case '__siteexport_addsite': $this->ajax_siteexport_addsite($event); break;
69 case '__siteexport_generateurl': $this->ajax_siteexport_generateurl($event); break;
70 case '__siteexport_aggregate': $this->ajax_siteexport_aggregate($event); break;
75 * Export from a URL - action
82 $keys = is_array($event->data) ? array_keys($event->data) : null;
83 $command = is_array($keys) ? array_shift($keys) : $event->data;
85 $event->data = act_clean($event->data);
88 msg("The siteexport function has to be called prior to any header output.", -1);
91 $this->__init_functions();
93 $this->functions->debug->message("========================================", null, 1);
94 $this->functions->debug->message("Starting export from URL call", null, 1);
95 $this->functions->debug->message("----------------------------------------", null, 1);
97 $event->preventDefault();
98 $event->stopPropagation();
102 $_REQUEST['sectok'] = $this->functions->getSecurityToken();
107 $timerdiff = $this->getConf('max_execution_time');
109 $data = $this->__get_siteexport_list_and_init_tocs($ID, !empty($_REQUEST['startcounter']));
119 if ( count($data) == 0 && !$this->functions->settings->hasValidCacheFile ) {
129 $status = $this->__siteexport_add_site($site['id']);
132 … $this->functions->debug->message("----------------------------------------", null, 1);
133 … $this->functions->debug->message("Errors during export from URL call", null, 1);
134 … $this->functions->debug->message("========================================", null, 1);
135 print $this->functions->debug->runtimeErrors;
142 if (time()-$starttimer >= $timerdiff) {
143 $this->functions->debug->message("Will Redirect", null, 1);
144 $this->handleRuntimeErrorOutput();
145 $this->functions->startRedirctProcess($counter);
149 $this->functions->debug->message("----------------------------------------", null, 1);
150 $this->functions->debug->message("Finishing export from URL call", null, 1);
151 $this->functions->debug->message("========================================", null, 1);
153 $this->cleanCacheFiles();
155 …his->functions->settings->origZipFile, array('cache' => 'nocache', 'siteexport' => $this->function…
156 $this->functions->debug->message("Redirecting to final file", $URL, 2);
158 $this->handleRuntimeErrorOutput();
165 if (!empty($this->functions->debug->runtimeErrors))
167 …$this->filewriter->__moveDataToZip($this->functions->debug->runtimeErrors, '_runtime_error/' . tim…
177 $this->functions = new siteexport_functions(true, $isAJAX);
178 $this->filewriter = new siteexport_zipfilewriter($this->functions);
181 if ($this->filewriter->canDoPDF()) {
182 $this->functions->settings->fileType = 'pdf';
193 $event->preventDefault();
194 $event->stopPropagation();
197 $this->functions->debug->message("Prepared URL and POST from Request:", $_REQUEST, 2);
198 $url = $this->functions->prepare_POSTData($_REQUEST);
199 $combined = $this->functions->urlToPathAndParams($url);
203 $this->functions->debug->message("Prepared URL and POST data:", $return, 2);
214 … list($url, $combined, $path, $POSTData) = $this->ajax_siteexport_prepareURL_and_POSTData($event);
216 // WGET Redirects - this is an option for wget only.
217 …ects that we want to allow. A Problem is that we don't know how long it will take to fetch one page
218 …// Therefore we assume it takes about 5s for each page - that gives the freedom to have anough tim…
219 …$maxRedirectNumber = ceil((count($this->__get_siteexport_list($INPUT->str('ns'), true))*5)/$this->…
220 … $maxRedirect = $maxRedirectNumber > 0 ? '--max-redirect=' . ($maxRedirectNumber+3) . ' ' : '';
221 $maxRedirs = $maxRedirectNumber > 0 ? '--max-redirs ' . ($maxRedirectNumber+3) . ' ' : '';
223 $this->functions->debug->message("Generating Direct Download URL", $url, 2);
226 if (!$this->functions->debug->firstRE()) {
227 …$this->functions->debug->message("There have been errors while generating the download URLs.", nul…
231 $zipFile = explode(":", ($this->getConf('zipfilename')));
236 …edirect . '--output-document=' . $zipFile . ' --post-data="' . $POSTData . '" ' . wl(cleanID($path…
238 …echo 'curl -L ' . $maxRedirs . '-o ' . $zipFile . ' -d "' . $POSTData . '" ' . wl(cleanID($path), …
241 $this->functions->debug->message("Checking for Cron parameters: ", $combined, 1);
253 $event->preventDefault();
254 $event->stopPropagation();
256 $data = $this->__get_siteexport_list_and_init_tocs($INPUT->str('ns'));
262 … $this->functions->debug->runtimeException("No data generated. List of Files is 'false'.");
266 if (empty($data) && !$this->functions->settings->hasValidCacheFile)
268 $this->functions->debug->runtimeException("Generated list is empty.");
273 if (!$this->functions->debug->firstRE())
275 … $this->functions->debug->message("There have been errors while generating site list.", null, 4);
279 echo "{$this->functions->settings->pattern}\n";
280 echo $this->functions->downloadURL() . "\n";
291 if ($this->filewriter->hasValidCacheFile($_REQUEST)) {
292 $this->functions->debug->message("Had a valid cache file and will use it.", null, 2);
293 print $this->functions->downloadURL();
295 $event->preventDefault();
296 $event->stopPropagation();
299 $this->functions->debug->message("Will create a new cache thing.", null, 2);
300 $this->ajax_siteexport_addsite($event);
306 * Add a page to the package (for AJAX calls - Wrapper)
312 $event->preventDefault();
313 $event->stopPropagation();
315 $this->functions->debug->message("========================================", null, 1);
316 $this->functions->debug->message("Starting export from AJAX call", null, 1);
317 $this->functions->debug->message("----------------------------------------", null, 1);
319 $status = $this->__siteexport_add_site($INPUT->str('site'));
321 $this->functions->debug->message("----------------------------------------", null, 1);
322 $this->functions->debug->message("Errors during export from AJAX call", null, 1);
323 $this->functions->debug->message("========================================", null, 1);
327 $this->functions->debug->message("----------------------------------------", null, 1);
328 $this->functions->debug->message("Finishing export from AJAX call", null, 1);
329 $this->functions->debug->message("========================================", null, 1);
331 // Print the download zip-File
332 $this->cleanCacheFiles();
335 if (!$this->functions->debug->firstRE()) {
336 $this->functions->debug->message("There have been errors during the export.", null, 4);
340 print $this->functions->downloadURL();
345 * Fetch the list of pages to be exported
351 $NS = $this->namespace = $this->functions->getNamespaceFromID($NS, $PAGE);
352 …$this->functions->debug->message("ROOT Namespace to export from: '{$NS}' / {$this->namespace}", nu…
354 $depth = $this->getConf('depth');
358 switch ($INPUT->int('depthType')) {
360 $PAGE = $this->functions->cleanID(str_replace(":", "/", $NS . ':' . $PAGE));
361 $NS = (new PageResolver($NS))->resolveId($PAGE);
367 $this->functions->debug->message("Checking for Cache, depthType:0", null, 2);
368 if (!$overrideCache && $this->filewriter->hasValidCacheFile($_REQUEST, $data))
373 $this->functions->debug->message("Exporting the following sites: ", $data, 2);
378 case 1: $depth = 0;
380 case 2: $depth = $INPUT->int('depth');
384 $opts = array('depth' => $depth, 'skipacl' => $this->getConf('skipacl'), 'query' => $query);
385 $this->functions->debug->message("Options", $opts, 2);
391 if (!$this->functions->settings->useTOCFile) {
392 search($data, $conf['datadir'], $doSearch, $opts, $this->namespace);
394 $this->functions->debug->message("Using TOC for data", null, 2);
402 search($RAWdata, $conf['datadir'], $doSearch, $opts, $this->namespace);
417 $this->functions->debug->message("Checking for Cache after lookup of pages", null, 2);
418 if (!$overrideCache && $this->filewriter->hasValidCacheFile($_REQUEST, $data))
423 $this->functions->debug->message("Exporting the following sites: ", $data, 2);
430 if (!$isRedirected && !$this->__removeOldZip()) {
431 $this->functions->debug->runtimeException("Can't remove old files.");
435 $data = $this->__get_siteexport_list($NS, $isRedirected);
439 $this->functions->debug->message("List is empty I guess. Used NS: '{$NS}' ", null, 1);
443 // Create Eclipse Documentation Pages - TOC.xml, Context.xml
444 if (!empty($_REQUEST['absolutePath'])) $this->namespace = "";
445 // $this->__removeOldZip( $this->functions->settings->eclipseZipFile );
449 $toc = new siteexport_toc($this->functions, $NS);
450 $this->functions->debug->message("Generating eclipseDocZip", null, 2);
451 $this->filewriter->__moveDataToZip($toc->__getTOCXML($data), 'toc.xml');
452 $this->filewriter->__moveDataToZip($toc->__getContextXML($data), 'context.xml');
455 $toc = new siteexport_javahelp($this->functions, $this->filewriter, $NS);
456 $toc->createTOCFiles($data);
458 /* $toc = new siteexport_toc($this->functions);
459 list($tocData, $mapData) = $toc->__getJavaHelpTOCXML($data);
460 $this->functions->debug->message("Generating JavaHelpDocZip", null, 2);
461 $this->filewriter->__moveDataToZip($tocData, 'toc.xml');
462 $this->filewriter->__moveDataToZip($mapData, 'map.xml');
477 $this->functions->debug->message("========================================", null, 2);
478 $this->functions->debug->message("Adding Site: '$ID'", null, 2);
479 $this->functions->debug->message("----------------------------------------", $_REQUEST, 2);
481 $request = $this->functions->settings->additionalParameters;
486 …//documentation:81/helpdesk/de/hds/getting-started?depthType=0&do=siteexport&ens=helpdesk%3Ade%3Ah…
488 …$do = $INPUT->int('exportbody', 0, true) == 1 ? $INPUT->str('renderer', $conf['renderer_xhtml'], t…
490 if ($do == 'pdf' && $this->filewriter->canDoPDF())
493 $INPUT->set('origRenderer', $INPUT->str('renderer', $conf['renderer_xhtml'], true));
494 } else if ($INPUT->str('renderer') == 'dw2pdf') {
498 …$do = ($do == $conf['renderer_xhtml'] && $INPUT->int('exportbody', 0, true) != 1) ? '' : 'export_'…
506 if (!empty($INPUT->str('template'))) {
507 $request['template'] = $INPUT->str('template');
510 $this->functions->debug->message("REQUEST for add_site:", $request, 2);
512 $ID = $this->functions->cleanID($ID);
513 $url = $this->functions->wl($ID, $request, true, '&');
516 $CURRENT_PARENT = $fileName = $this->functions->getSiteName($ID, true);
517 $this->functions->debug->message("Filename could be:", $fileName, 2);
519 $this->fileChecked[$url] = $fileName; // 2010-09-03 - One URL to one FileName
520 $this->functions->settings->depth = str_repeat('../', count(explode('/', $fileName))-1);
522 // fetch URL and save it in temp file
523 $tmpFile = $this->__getHTTPFile($url);
525 …$this->functions->debug->runtimeException("Creating temporary download file failed for '$url'. See…
531 if ( $this->filewriter->canDoPDF() ) {
533 … $this->functions->debug->message("Will replace old filename '{$fileName}' with {$ID}", null, 1);
537 …// 2014-04-29 added cleanID to ensure that links are generated consistently when using [[this>...]…
538 …$fileName = $dirname . '/' . $this->functions->cleanID($this->functions->getSiteTitle($ID)) . '.' …
539 …} else if ( !empty($tmpFile[1]) /*&& !strstr($DATA[2], $tmpFile[1])*/ ) { // 2017-11-30: $DATA is …
541 …$this->functions->debug->message("Will replace old filename '{$fileName}' with {$dirname}/{$tmpFil…
546 $this->fileChecked[$url] = $fileName;
547 $status = $this->filewriter->__addFileToZip($tmpFile[0], $fileName);
549 $this->functions->debug->message("Could not remove temporary file", $tmpFile[0], 1);
562 $EXCLUDE = $this->functions->settings->excludePattern;
566 $this->functions->debug->message("Checking for exclude: ", array(
575 $http = new HTTPProxy($this->functions);
576 $http->max_bodysize = $conf['fetchsize'];
579 $this->functions->addAdditionalParametersToURL($URL, $newAdditionalParameters);
581 $this->functions->debug->message("Fetching URL: '$URL'", null, 2);
582 $getData = $http->get($URL, true); // true == sloopy, get 304 body as well.
584 …if( $getData === false ) { // || ($http->status != 200 && !$this->functions->settings->ignoreNon20…
586 if ( $http->status != 200 && $this->functions->settings->ignoreNon200 ) {
587 …$this->functions->debug->message("HTTP status was '{$http->status}' - but I was told to ignore it …
591 …$this->functions->debug->message("Sending request failed with error, HTTP status was '{$http->stat…
596 $this->functions->debug->message("No data fetched", $URL, 4);
600 $this->functions->debug->message("Headers received", $http->resp_headers, 2);
604 $this->functions->debug->message("========================================", null, 1);
605 $this->functions->debug->message("Starting to recurse file '$URL'", null , 1);
606 $this->functions->debug->message("----------------------------------------", null, 1);
607 $this->__getInternalLinks($getData);
608 $this->functions->debug->message("----------------------------------------", null, 1);
609 $this->functions->debug->message("Finished to recurse file '$URL'", null , 1);
610 $this->functions->debug->message("========================================", null, 1);
613 …$tmpFile = tempnam($this->functions->settings->tmpDir , 'siteexport__') ?: $this->functions->setti…
614 $this->functions->debug->message("Temporary filename", $tmpFile, 1);
618 $this->functions->debug->message("Can't open temporary File '$tmpFile'.", null , 4);
626 $extension = explode(';', $http->resp_headers['content-type'], 2);
629 if ( $extension[0] == 'image' && preg_match("/^[a-zA-Z0-9]{3,}$/", $extension[1]) ) {
631 $this->functions->debug->message("Found new image extension:", $extension, 2);
636 …mpFile, preg_replace("/.*?filename=\"?(.*?)\"?;?$/", "$1", $http->resp_headers['content-dispositio…
645 if (!$this->functions->settings->exportLinkedPages) {
653 // Match CSS url(...) but avoid plain text like "API-URL (foo)"
654 $PATTERNCSS = '(?<![A-Za-z0-9_-])(url\s*?)\(([^\)]*)\)';
667 $this->functions->debug->message("SRCSET", $DATA, 2);
677 $this->functions->debug->message("SRCSET: URL before: '$url'", null, 2);
678 $url = $this->__fetchAndReplaceLink(array( $url, '', $url ));
679 $url = substr( $url, 2, -1 );
680 $this->functions->debug->message("SRCSET: URL after: '$url'", null, 2);
689 * Deep Fetch and replace of links inside the texts matched by __getInternalLinks
695 $newAdditionalParameters = $this->functions->settings->additionalParameters;
696 $newDepth = $this->functions->settings->depth;
702 …$this->functions->debug->message("Starting Link Replacement", array('data' => $DATA, 'additional P…
705 if ( $this->__fetchAndReplaceWellKnownLinks( $DATA ) ) {
706 return $this->__rebuildLink($DATA, "");
709 // 2014-07-21: Origdata before anything else - or it will be missing some things.
711 …// $ORIGDATA2 = $DATA[2]; // 08/10/2010 - this line required a $this->functions->wl which m…
712 $this->functions->debug->message("OrigDATA is:", $ORIGDATA2, 1);
720 …// 2014-05-12 - fix problem with URLs starting with a ./ or ../ ... they seem to need the current …
725 // 2010-08-25 - fix problem with relative movement in links ( "test/../test2" )
726 // 2014-06-30 - what? to what will this end relatively?
736 …$hadBase = true; // 2010-08-23 Check if there has been a rewrite here that will have to be conside…
739 …$this->functions->debug->message("URL before rewriting option for others than 1", array($DATA, $PA…
742 // Handle rewrites other than 1 - just for non-lib-files
743 $this->__fetchAndReplaceLinkHandleRewrite( $DATA, $PARAMS );
745 $this->functions->debug->message("URL before rewriting option", array($DATA, $PARAMS), 2);
756 …$MEDIAMATCHER = "#(_media(/|:)|media=|_detail(/|:)|_export(/|:)|do=export_)#i"; // 2010-10-23 adde…
762 $ID = $this->functions->cleanID($DATA[2], null, $ISMEDIA);
763 …// $ID = $this->functions->cleanID($DATA[2], null, strstr($DATA[2], 'media') ); // Export a…
765 …// $IDexists = page_exists($ID); // 08/10/2010 - Not needed. This will be done in the next …
766 …// $this->functions->debug->message("Current ID: '$ID' exists: '" . ($IDexists ? 'true' : '…
768 $IDifIDnotExists = $ID; // 08/10/2010 - Save ID - with possible upper cases to preserve them
771 $this->functions->debug->message("Resolving ID: '$ID'", null, 2);
773 $ID = (new MediaResolver('root'))->resolveId($ID);
775 … $this->functions->debug->message("Current mediaID to filename: '" . mediaFN($ID) . "'", null, 2);
777 $ID = (new PageResolver('root'))->resolveId($ID);
779 … $this->functions->debug->message("Current ID to filename: '" . wikiFN($ID) . "'", null, 2);
782 …$this->functions->debug->message("Current ID after resolvement: '$ID' the ID does exist: '" . ($ID…
783 …// $ORIGDATA2 = @parse_url($this->functions->wl($ORIGDATA2, null, true)); // What was the n…
784 …// $this->functions->debug->message("OrigData ID after parse:", $ORIGDATA2, 1); // 08/10/20…
786 …// 08/10/2010 - If the ID does not exist, we may have a problem here with upper cases - they will …
791 …// $this->functions->cleanID($DATA[2], null, strstr($DATA[2], 'media') || strstr($DATA[2], 'export…
792 if (substr($ID, -1) == ':' || empty($ID)) $ID .= $conf['start'];
797 $this->functions->removeWikiVariables($PARAMS, false, true);
799 …$url = $this->functions->wl($ID, null, true, null, null, true, $hadBase) . (!empty($ANCHOR) ? '#' …
800 $this->functions->debug->message("URL from ID: '$url'", null, 2);
806 $this->functions->debug->message("DATA after parsing.", $DATA, 2);
809 …if ($conf['userewrite'] == 2 && preg_match("%((/lib/exe/(fetch|detail|indexer)|feed|doku)\.php)/?(…
813 …$PARAMS .= '&' . (in_array($matches[3], array('fetch', 'detail')) ? 'media' : 'id') . '=' . cleanI…
815 …$this->functions->debug->message("DATA after second rewrite with UseRewrite = 2", array($DATA, $ma…
823 …$result = $this->__fetchAndReplaceLinkMainSwitch( $elements, $DATA, $url, $newAdditionalParameters…
828 …$this->functions->debug->message("DATA after SWITCH CASE decision", array($DATA, $noDeepReplace, $…
830 if ($this->filewriter->canDoPDF()) {
831 $this->functions->addAdditionalParametersToURL($url, $newAdditionalParameters);
834 $url = $this->__rebuildLink($DATA, '');
836 $this->functions->debug->message("Creating PDF with URL '$url'", null, 2);
842 …return $this->__fetchAndReplaceLinkFinish( $DATA, $url, $noDeepReplace, $newAdditionalParameters, …
848 …hp' : // $DATA[2] .= ( !$this->functions->settings->addParams || empty($PARAMS) ? '' : '.' …
849 …$DATA[2] .= '.' . $this->functions->cleanID(preg_replace("/(=|\?|&)/", ".", $PARAMS)) . '.css'…
853 $fileName = $this->functions->getSiteName($ID, true);
856 …$newDepth = './' . str_repeat('../', count(explode('/', $fileName))-1); // it is an ID at this poi…
859 …$this->functions->debug->message("This is CSS file", array($DATA, $noDeepReplace, $fileName, $newD…
863 …php' : // $DATA[2] .= ( !$this->functions->settings->addParams || empty($PARAMS) ? '' : '.' …
864 …$DATA[2] .= '.t.' . $this->functions->cleanID($_REQUEST['template']) . '.js'; // allways put param…
873 …$this->functions->debug->message("This is JS file", array($DATA, $url, $newAdditionalParameters), …
876 … Detail Handling with extra Rewrites if Paramaters are available - otherwise this is just the fetch
878 $this->functions->debug->message("Skipping indexer", null, 2);
883 $this->__getParamsAndDataRewritten($DATA, $PARAMS, 'media');
884 … $ID = $this->functions->cleanID(str_replace('/', ':', $DATA[2]), null, strstr($DATA[2], 'media'));
885 …$fileName = $this->functions->getSiteName($ID, true); // 2010-09-03 - rewrite with override enabled
887 $newDepth = str_repeat('../', count(explode('/', $fileName))-1);
888 $this->__rebuildDataForNormalFiles($DATA, $PARAMS);
891 …$this->functions->debug->message("This is detail.php file with addParams", array($DATA, $ID, $file…
896 $this->__getParamsAndDataRewritten($DATA, $PARAMS, 'id');
897 $ID = $this->functions->cleanID($DATA[2], null, strstr($DATA[2], 'id'));
899 …$this->functions->debug->message("Current ID to filename (doku.php): '" . wikiFN($ID) . "'", null,…
901 … $fileName = $this->functions->getSiteName($ID); // 2010-09-03 - rewrite with override enabled
903 $newDepth = str_repeat('../', count(explode('/', $fileName))-1);
904 $this->__rebuildDataForNormalFiles($DATA, $PARAMS);
908 …$this->functions->debug->message("This is doku.php file with addParams", array($DATA, $ID, $fileNa…
909 return $this->__rebuildLink($DATA);
911 // Fetch Handling for media - rewriting everything
912 case 'fetch.php':
913 $this->__getParamsAndDataRewritten($DATA, $PARAMS, 'media');
916 $ID = $this->functions->cleanID($DATA[2], null, strstr($DATA[2], 'media'));
917 $ID = (new MediaResolver('root'))->resolveId($ID);
920 $DATA[2] = $this->functions->wl($ID, null, null, null, $IDexists, true);
921 $this->__rebuildDataForNormalFiles($DATA, $PARAMS);
926 … $this->functions->debug->message("This is fetch.php file", array($DATA, $ID, $PARAMS), 2);
937 $this->__rebuildDataForNormalFiles($DATA, $PARAMS);
939 …$fileIDPart = isset($backlinkID[1]) && !empty($backlinkID[1]) ? $this->functions->cleanID(urldecod…
942 …$DATA[2] .= ':' . $fileIDPart . '.' . $this->functions->settings->fileType; // add namespace and s…
945 $fileName = $this->functions->shortenName($DATA[2]);
946 $newDepth = str_repeat('../', count(explode('/', $fileName))-1);
947 … $url .= (strstr($url, '?') ? '&' : '?') . 'id=' . $fileIDPart; // add id-part to URL for backlinks
951 …$this->functions->debug->message("This is something with '_detail' file", array($DATA, $backlinkID…
955 $this->__rebuildDataForNormalFiles($DATA, $PARAMS);
962 … $this->functions->debug->message("This is something with '_export' file", $DATA, 2);
964 … } else if ($IDexists) { // 08/10/2010 - was page_exists($ID) - but this should do as well.
966 …->functions->settings->addParams || empty($PARAMS) ? '' : '.' . $this->functions->cleanID(preg_rep…
968 $DATA[2] = $this->functions->shortenName($DATA[2]);
970 … // If Parameters are to be included in the filename - they must not be added twice
971 if ($this->functions->settings->addParams) $DATA['PARAMS'] = "";
973 $this->functions->debug->message("This page really exists", $DATA, 1);
975 return $this->__rebuildLink($DATA, null, $ID);
977 $this->__rebuildDataForNormalFiles($DATA, $PARAMS, true);
978 …$newAdditionalParameters = null; // 2014-06-27 - when using the "normal" files way we will not nee…
993 $DATA[2] = $this->functions->shortenName($DATA[2]);
997 …// 2010-10-23 - changes in_array from DATA[2] to $url - to check real URLs, the DATA[2] file will …
998 if (in_array($url, array_keys($this->fileChecked))) {
999 $DATA[2] = $this->fileChecked[$url];
1000 … $this->functions->debug->message("File has been checked before.", array($DATA, $url), 2);
1001 return $this->__rebuildLink($DATA);
1004 // 2010-09-03 - second check if the file is in the ZIP already.
1005 if ($this->filewriter->fileExistsInZip($DATA[2])) {
1006 $this->functions->debug->message("File with DATA exists in ZIP.", $DATA, 3);
1007 return $this->__rebuildLink($DATA);
1010 // 2010-10-23 - What if this is a fetch.php? than we produced an error.
1011 // $this->fileChecked[] = $DATA[2];
1014 $origDepth = $this->functions->settings->depth;
1015 $this->functions->settings->depth = $newDepth;
1021 …$this->functions->debug->message("Going to get the file", array($url, $noDeepReplace, $newAddition…
1022 $tmpFile = $this->__getHTTPFile($url, $noDeepReplace, $newAdditionalParameters);
1023 …$this->functions->debug->message("The getHTTPFile result is still empty", $tmpFile === false ? 'YE…
1027 $this->functions->settings->depth = $origDepth; // 2010-09-03 - Reset depth at the very end
1032 $this->functions->debug->message("The fetched file '$url' is 'false'", null, 3);
1034 … $this->functions->debug->message("The file does not exist, fallback to ORIGDATA", $ORIGDATA2, 2);
1035 $DATA[2] = $this->functions->shortenName($ORIGDATA2[2]); // get Origdata Path
1038 $this->fileChecked[$url] = $DATA[2]; // 2010-09-03 - One URL to one FileName
1039 $link = $this->__rebuildLink($DATA);
1040 $this->functions->debug->message("Final Link after empty file from '$url'", null, 2);
1044 // Non-200 ignored; keep original link intact.
1048 $this->functions->debug->message("The fetched file looks good.", $tmpFile, 2);
1052 // 2014-02-28 But only if we are on PDF Mode. Does this produce any other Problems?
1053 … if ( $this->filewriter->canDoPDF() && !empty($tmpFile[1]) && !strstr($DATA[2], $tmpFile[1]) ) {
1055 $this->functions->debug->message("Changed filename.", $DATA[2], 2);
1058 // Custom extension if not set already - 2014-07-02
1061 $this->functions->debug->message("Added extension provided from Server.", $DATA[2], 2);
1065 $this->fileChecked[$url] = $DATA[2]; // 2010-09-03 - One URL to one FileName
1067 $this->filewriter->__addFileToZip($tmpFile[0], $DATA[2]);
1069 $this->functions->debug->message("Could not delete temporary file.", $tmpFile[0], 2);
1072 $newURL = $this->__rebuildLink($DATA);
1073 $this->functions->debug->message("Returning final Link to document: '$newURL'", null, 2);
1079 … // $DATA[2] = urldecode($DATA[2]); // Leads to problems because it does not re-encode the url
1082 …$this->functions->debug->message("Don't like http, mailto, data or javascript links here", null, 1…
1085 …(https?://|mailto:|" . DOKU_BASE . "/_export/)%", $DATA[2]) ) { return $this->__rebuildLink($DATA,…
1086 // External media - this is deep down in the link, so we have to grep it out
1089 $this->functions->debug->message("This is an HTTP like somewhere else", $DATA, 1);
1094 $this->functions->debug->message("This is a refercence only", null, 1);
1101 // Handle rewrites other than 1 - just for non-lib-files
1105 …$this->functions->debug->message("Did not match '$^(" . DOKU_BASE . ")?lib/$' userewrite == {$conf…
1107 $DATA[2] = $this->__getInternalRewriteURL($DATA[2]);
1109 $this->__getParamsAndDataRewritten($DATA, $PARAMS);
1112 $this->functions->debug->message("This file must be inside lib ...", null, 2);
1119 private function __rebuildLink($DATA, $DEPTH = null, $existingPageID = null) { argument
1122 // depth is set, skip this one
1123 if (is_null($DEPTH)) $DEPTH = $this->functions->settings->depth;
1124 …$DATA[2] .= (!empty($DATA['PARAMS']) && $this->functions->settings->addParams ? '?' . $DATA['PARAM…
1126 $intermediateURL = $DEPTH . $DATA[2];
1128 …// 2012-06-15 originally has an absolute path ... we might need a relative one if not in our names…
1131 …$this->functions->debug->message("OK, this is not to be absolute: ", array($intermediateURL, $CURR…
1132 …$intermediateURL = $this->functions->getRelativeURL($intermediateURL, $CURRENT_PARENT, $existingPa…
1136 $this->functions->debug->message("Re-created URL: '$newURL'", $DEPTH, 2);
1152 $FILENAMEID = $this->functions->settings->origZipFile;
1163 $this->functions->authenticate();
1164 return $this->__removeOldZip($FILENAMEID, $checkForMore, true);
1174 $fn = $this->functions->getSpecialExportFileName(noNS($FILENAMEID), '.+');
1182 $cache = $this->functions->settings->cachetime;
1186 if ($media['mtime'] < time()-$cache) {
1187 $this->__removeOldZip($media['id'], false, $reauthenticated);
1198 * if confrewrite is set to internal rewrite, use this function - taken from a DW renderer
1275 // add anyways - if on overridde
1276 if (!$this->functions->settings->addParams && !empty($PARAMS) && $addHash) {
1278 } else if (!$this->functions->settings->addParams) {
1282 …rnalParams) ? '' : '.' . $this->functions->cleanID($internalParams)) . ($EXT == '.php' ? '.' . $th…
1284 $this->functions->debug->message("Rebuilding Data for normal file.", $DATA[2], 1);
1293 …$cache = getCacheName('scripts' . $_SERVER['HTTP_HOST'] . '-siteexport-js-' . $_SERVER['SERVER_POR…
1294 $this->unlinkIfExists($cache);
1296 $tpl = trim(preg_replace('/[^\w-]+/', '', $_REQUEST['template']));
1305 …$cache = getCacheName('styles' . $_SERVER['HTTP_HOST'] . '-siteexport-js-' . $_SERVER['SERVER_PORT…
1306 $this->unlinkIfExists($cache);
1314 $this->functions->debug->message('Could not remove file', $cache, 1 );
1318 $this->functions->debug->message('Could not remove file', $cache . '.gz', 1 );