33namespace ProcessWire;
44
55/*
6- * Contributors:
6+ * Contributors and thanks to :
77 * - Szabesz (@szabeszg)
88 * - Stan Lindsey (@stanlindsey)
99 * - Adrian Jones (@adrianbj)
@@ -226,7 +226,6 @@ class Duplicator extends WireData implements Module, ConfigurableModule
226226
227227 $this->config->styles->add($this->config->urls->{$this->className} . "{$this->className}.css");
228228 $this->config->scripts->add($this->config->urls->{$this->className} . "Assets/lib/baffle.min.js");
229- $this->config->scripts->add($this->config->urls->{$this->className} . "{$this->className}.js");
230229
231230 $this->defaultPath = wire('config')->paths->assets . self::DUP_DEFAULT_LOCAL_FOLDER;
232231 if (!is_dir($this->defaultPath) && empty($this->path)) {
@@ -607,9 +606,11 @@ class Duplicator extends WireData implements Module, ConfigurableModule
607606 return false;
608607 }
609608
609+
610+
610611 /*
611- * call this function from a cron tool to launch the backup task
612- */
612+ * call this function from a cron tool to launch the backup task
613+ */
613614 public function ___cronJob()
614615 {
615616 if (!$this->useLocalFolder && !$this->useDropbox && !$this->useGoogleDrive && !$this->useAmazonS3 && !$this->useFTP) {
@@ -711,7 +712,7 @@ class Duplicator extends WireData implements Module, ConfigurableModule
711712 throw new WireException("AmazonS3 SDK not installed.");
712713 }
713714
714- $amazonaws = new \ AmazonS3Client();
715+ $amazonaws = new AmazonS3Client();
715716 $amazonaws->setAccessKey($this->awsAccessKey);
716717 $amazonaws->setSecretKey($this->awsSecretKey);
717718 $amazonaws->setRegion($this->awsRegion);
@@ -731,7 +732,7 @@ class Duplicator extends WireData implements Module, ConfigurableModule
731732 $amazonaws->upload($package['zipfile'], $packageName, $this->awsSubDir);
732733 //if($url === null) throw new AmazonS3ClientException("AmazonS3: An error occured while uploading package <{$packageName}>");
733734 $amazonaws->deleteOldBackups($this->maxPackages, $this->deadline);
734- } catch (\ AmazonS3ClientException $ex) {
735+ } catch (AmazonS3ClientException $ex) {
735736 DUP_Logs::log("[AmazonS3] error: " . $ex->getMessage(), 'warning');
736737 }
737738 }
@@ -853,7 +854,13 @@ class Duplicator extends WireData implements Module, ConfigurableModule
853854
854855 $dirsToProcess = ['/']; // Start at root
855856
856- set_time_limit(300); // Try to allow longer execution time
857+ if ($this->cronMode !== 'none') {
858+ DUP_Logs::log("- running ZipData2() with cronMode = {$this->cronMode}");
859+ DUP_Logs::log("- trying to allow longer execution time");
860+ set_time_limit(300); // Try to allow longer execution time
861+ DUP_Logs::log("- php time limit => " . ini_get('max_execution_time') . " sec");
862+ }
863+
857864 while ($thisDir = array_shift($dirsToProcess)) { // Process first entry in array
858865 $fullPath = $rootDirectory . $thisDir;
859866
@@ -935,7 +942,12 @@ class Duplicator extends WireData implements Module, ConfigurableModule
935942
936943 $zipLog->verbose("OPENED ZIP: {$zipfile}");
937944 $fragmentBytes = 0;
938- set_time_limit(300);
945+ if ($this->cronMode !== 'none') {
946+ DUP_Logs::log("- running ZipData2() with cronMode = {$this->cronMode}");
947+ DUP_Logs::log("- trying to allow longer execution time");
948+ set_time_limit(300); // Try to allow longer execution time
949+ DUP_Logs::log("- php time limit => " . ini_get('max_execution_time') . " sec");
950+ }
939951 }
940952 } else {
941953 $ret['errors'][] = $filePath;
@@ -1230,6 +1242,7 @@ class Duplicator extends WireData implements Module, ConfigurableModule
12301242 $out .= " <a class='github-button' href='https://github.com/flydev-fr/Duplicator' data-show-count='false' aria-label='Documentation' data-size='large'>Doc</a>";
12311243 $out .= " </div>";
12321244 $out .= "</div>";
1245+ $out .= "<script>baffle('.dup-glitch', {characters: '█▓█ ▒░1▒░3█░▒▓3 █▒▒7▓▒▓ █ ░█▒ ▒▓░: █)░▒ ▓░', speed: 110}).reveal(11500);</script>";
12331246
12341247 $fs = $modules->get("InputfieldFieldset");
12351248 $fs->label = " ";
@@ -1405,6 +1418,7 @@ class Duplicator extends WireData implements Module, ConfigurableModule
14051418 if ($data['cycle'] == 'logoutTrigger') {
14061419 $field->notes = __("The cronjob to backup your database executes only if current user has db-backup permission.");
14071420 }
1421+ $field->showIf = "cronMode='LazyCron'";
14081422
14091423 $field->addOptions(array(
14101424 0 => __('Trigger disabled'),
@@ -1516,14 +1530,14 @@ class Duplicator extends WireData implements Module, ConfigurableModule
15161530 $f->description = __("Shell script used to backup database in Native Mode.");
15171531 $f->notes = __("This script is used to backup database in Native Mode. You can edit this script to fit your needs.");
15181532 // load from stub
1519- $f->value = $data['shellScript'] ? $data['shellScript'] : '';
15201533 $f->icon = 'terminal';
15211534 $f->columnWidth = 100;
15221535 $f->rows = 18;
15231536 $f->collapsed = $data['backup_mode'] == self::DUP_MODE_NATIVE ? ($data['shellScript'] == '' ? true : false) : false;
15241537 $f->showIf = "backup_mode=".self::DUP_MODE_NATIVE;
15251538 $stub = DUP_Util::getStub();
1526- $f->placeholder = $stub ? file_get_contents($stub) : 'Paste or write your custom dump shell script here...';
1539+ $f->placeholder = 'Paste or write your custom dump shell script here...';
1540+ $f->value = $data['shellScript'] ? $data['shellScript'] : ($stub ? file_get_contents($stub) : '');
15271541 $fs->append($f);
15281542
15291543 $field = $modules->get('InputfieldCheckbox');
@@ -1543,6 +1557,9 @@ class Duplicator extends WireData implements Module, ConfigurableModule
15431557
15441558 $fields->append($fs);
15451559
1560+ /**
1561+ * Cloud Providers Settings
1562+ */
15461563 $fs = $modules->get("InputfieldFieldset");
15471564 $fs->label = "Save package to";
15481565 $fs->icon = 'cloud';
@@ -1738,7 +1755,7 @@ class Duplicator extends WireData implements Module, ConfigurableModule
17381755 $fs->append($fsgd);
17391756
17401757 // AMAZON
1741- if (!class_exists('AmazonS3Client ')) {
1758+ if (!class_exists('\Aws\S3\S3Client ')) {
17421759 $skip = true;
17431760 }
17441761 $description = ($skip == false) ? $disabled = '' : __("The required SDK is not installed. You can download it [here](https://github.com/flydev-fr/duplicator-amazon-s3) or install it with [Composer](https://getcomposer.org/doc/00-intro.md). Run **composer require aws/aws-sdk-php**");
@@ -1843,4 +1860,4 @@ class Duplicator extends WireData implements Module, ConfigurableModule
18431860
18441861 $event->return = str_replace("</head>", "\r\n$github</head>", $event->return);
18451862 }
1846- }
1863+ }
0 commit comments