/** * Update with some sensible defaults. * @param array $data * @return DataObject */ public function update($data) { return parent::update(CollectionTools::options_from_array($data, array('RemoteHost' => $_SERVER['SERVER_NAME'], 'Protocol' => $_SERVER['SERVER_PROTOCOL'], 'Proxy' => '', 'Path' => Replicant::asset_path(), 'UserName' => Member::currentUser()->Email))); }
/** * Update with some sensible defaults. * @param array $data * @return DataObject */ public function update($data) { return parent::update(CollectionTools::options_from_array($data, array('RemoteHost' => $_SERVER['SERVER_NAME'], 'Protocol' => $_SERVER['SERVER_PROTOCOL'], 'Proxy' => '', 'Path' => Replicant::asset_path(), 'FileName' => null, 'Database' => DatabaseTools::getDBCredential('Database')))); }
/** * Update with some sensible defaults. * @param array $data * @return DataObject */ public function update($data) { return parent::update(CollectionTools::options_from_array($data, array('RemoteHost' => null, 'Protocol' => null, 'Proxy' => '', 'UserName' => null, 'Password' => null, 'Path' => Replicant::config()->get('remote_path'), 'FileName' => ''))); }
/** * Override update with some usefull defaults and checks * @param array $data * @return DataObject */ public function update($data) { return parent::update(CollectionTools::options_from_array($data, array('RemoteHost' => null, 'Protocol' => 'http', 'Proxy' => '', 'Database' => DatabaseTools::getDBCredential('Database'), 'UserName' => Member::currentUser() ? Member::currentUser()->Email : $_SERVER['PHP_AUTH_USER'], 'Password' => '', 'Path' => Replicant::asset_path(), 'FileName' => FileSystemTools::filename_from_timestamp('.sql')))); }
/** * Fetch one or all remote dump files and writes to local filesystem. * * If filename is supplied as getVar then only that file will be retrieved, otherwise all files which don't exist locally will be retrieved up to number getVar. * * If filename is supplied as getVar then file will overwrite existing file. * * SideEffects: * Reads files from remote system. * Writes files to local filesystem. * Outputs results * * @param SS_HTTPRequest $request * @return int number of files fetched * @throws PermissionFailureException */ public function fetch(SS_HTTPRequest $request) { $options = CollectionTools::options_from_array($request->getVars(), array('RemoteHost' => $request->getIP(), 'Path' => Replicant::asset_path(), 'FileName' => '', 'UserName' => null, 'Password' => null)); $action = ReplicantActionFetch::create(); $action->checkPerm()->update($options)->execute(); return $action->format(); }