/** * Dump the current SilverStripe database to the local filesystem. * * Returns true on successful execution of mysqldump command, false otherwise. * * @param SS_HTTPRequest $request * @return bool * @throws PermissionFailureException */ public function dump(SS_HTTPRequest $request) { $options = CollectionTools::options_from_array($request->getVars(), array('RemoteHost' => $request->getIP(), 'Path' => Replicant::asset_path(), 'FileName' => FileSystemTools::filename_from_timestamp('.sql'), 'UseGZIP' => false)); $action = ReplicantActionDump::create(); $action->checkPerm()->update($options)->execute(); return $action->format(); }
/** * 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')))); }