public static function load($key, $config) { switch ($key) { case 'debug': self::$debug = $config; break; case 'developer': self::$developer = $config; break; case 'security': self::$security = $config; break; case 'securityKeys': self::$securityKeys = $config; break; case 'performance': self::$performance = $config; break; case 'relation': self::$relation = $config; break; } }
public function zipData() { $log = vglobal('log'); $log->debug('Start ' . __CLASS__ . ':' . __FUNCTION__); $dbFiles = $this->getFilesStructure(); $zip = new ZipArchive(); $destination = $this->tempDir . '/' . $this->get('filename') . '.files.zip'; $count = 1; $allFiles = $this->get('allfiles'); $mainConfig = $this->getConfig('main'); $maxTime = ini_get('max_execution_time') * 0.5; $startTime = self::getTime(); $singleMode = $mainConfig['type'] == 'true'; // Overall mode or Single mode if ($zip->open($destination, ZIPARCHIVE::CREATE) && $allFiles != 0) { foreach ($dbFiles as $id => $path) { $start = self::getTime(); if (is_dir($path)) { $zip->addEmptyDir($path . '/'); } elseif (is_file($path)) { $zip->addFile($path, $path); } $this->markFile($id); $this->updateProgress('5', $count / $allFiles * 100, self::getTime() - $start); $count++; if ($singleMode && self::getTime() - $startTime >= $maxTime) { continue; } } if (vglobal('encryptBackup') && version_compare(PHP_VERSION, '5.6.0') >= 0) { $code = $zip->setPassword(AppConfig::securityKeys('backupPassword')); if ($code === true) { $log->debug('Backup files password protection is enabled'); } else { $log->error('Has not been possible password protect your backup files'); } } $zip->close(); } $log->debug('End ' . __CLASS__ . ':' . __FUNCTION__); }