static function init() { $command = self::getCommand(); if ($command) { WPAdm_Core::$cron = false; wpadm_class::$type = 'full'; //$time_load = ini_get("max_execution_time"); //WPAdm_Core::log('proccess is work ' . $time_load . 'sec'); /*if ($time_load != 0) { self::run($time_load - 5); } else { self::run(90); } */ self::run(30); if (self::checkLock()) { $core = new WPAdm_Core($command, 'full_backup_dropbox', DRBBACKUP_BASE_DIR); if ($result = $core->getResult()->toArray(true)) { if ($result['result'] == 'success') { self::delCommand($command['method']); self::stop(); self::setCommandResultData($command['method'], $result); self::init(); } elseif ($result['result'] == 'error') { self::setCommandResultData($command['method'], $result); self::stop(); self::init_params_default(); } } } } }
function wpadm_run($pl, $dir) { require_once DRBBACKUP_BASE_DIR . '/modules/class-wpadm-method-class.php'; $request_name = $pl . '_request'; if (isset($_POST[$request_name]) && !empty($_POST[$request_name])) { require_once DRBBACKUP_BASE_DIR . '/modules/class-wpadm-core.php'; WPAdm_Core::$cron = false; $user_ip = wpadm_getIp(); if ($_SERVER['SERVER_ADDR'] != $user_ip && $_SERVER['HTTP_USER_AGENT'] != 'dropbox-backup user-agent') { WPAdm_Running::init_params_default(false); } $wpadm = new WPAdm_Core(wpadm_unpack($_POST[$request_name]), $pl, $dir); echo '<wpadm>' . wpadm_pack($wpadm->getResult()->toArray()) . '</wpadm>'; exit; } }
/** * @param string $method * @param mixed $params * @return null|WPAdm_Method_Class */ private function getObject($method, $params) { if (!preg_match("|[a-zA-Z0-9_\\-]|", $method)) { return null; } if (function_exists('mb_strtolower')) { $method = mb_strtolower($method); } else { $method = strtolower($method); } $class_file = self::$pl_dir . "/methods/class-wpadm-method-" . str_replace('_', '-', $method) . ".php"; if (file_exists($class_file)) { require_once $class_file; $tmp = explode('_', str_replace('-', '_', $method)); foreach ($tmp as $k => $m) { $tmp[$k] = ucfirst(strtolower($m)); } $method = implode('_', $tmp); $class_name = "WPAdm_Method_{$method}"; if (!class_exists($class_name)) { $this->getResult()->setError("Class '{$class_name}' not found"); $this->getResult()->setResult(WPAdm_result::WPADM_RESULT_ERROR); return null; } if (in_array(strtolower($method), self::$cron_method) && self::$cron) { WPAdm_Running::setCommand(strtolower($this->request['method']), $params); WPAdm_Running::run(); self::$cron = true; return true; } else { return new $class_name($params); } } return null; }