mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
API CHANGE Moved PostBackup class to module (see r63758)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63759 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
686c983f3e
commit
f009e8de8a
@ -1,41 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Writes the POST array to a file as a last-ditch effort to preserve entered data.
|
||||
* @package forms
|
||||
* @subpackage core
|
||||
*/
|
||||
class PostBackup extends Object {
|
||||
|
||||
static function writeToFile($data, $controller, $form) {
|
||||
|
||||
// the static variable defines whether or not to backup a posted form
|
||||
if(!$form->stat('backup_post_data'))
|
||||
return;
|
||||
|
||||
// Append to the file
|
||||
if(!file_exists(BACKUP_DIR))
|
||||
mkdir(BACKUP_DIR, Filesystem::$folder_create_mask, true);
|
||||
|
||||
$backupFile = fopen(BACKUP_DIR . '/' . $form->class, 'a');
|
||||
|
||||
$date = date('Y-m-d G:i:s');
|
||||
|
||||
$postData = var_export($data, true);
|
||||
|
||||
$backup = <<<BAK
|
||||
***BEGIN ENTRY***
|
||||
Date and time: {$date}
|
||||
URL: http://{$_SERVER['HTTP_HOST']}:{$_SERVER['SERVER_PORT']}{$_SERVER['PHP_SELF']}?{$_SERVER['QUERY_STRING']}
|
||||
Client IP: {$_SERVER['REMOTE_ADDR']}
|
||||
Controller: {$controller->class}
|
||||
|
||||
$postData
|
||||
***END ENTRY***
|
||||
BAK;
|
||||
|
||||
fwrite($backupFile, $backup);
|
||||
fclose($backupFile);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@ -23,8 +23,6 @@
|
||||
*/
|
||||
class Form extends RequestHandlingData {
|
||||
|
||||
public static $backup_post_data = false;
|
||||
|
||||
/**
|
||||
* Accessed by Form.ss; modified by formHtmlContent.
|
||||
* A performance enhancement over the generate-the-form-tag-and-then-remove-it code that was there previously
|
||||
|
Loading…
Reference in New Issue
Block a user