summaryrefslogtreecommitdiffstats
path: root/apps/files_texteditor/ajax
diff options
context:
space:
mode:
authorTom Needham <needham.thomas@gmail.com>2012-01-09 17:03:19 +0000
committerTom Needham <needham.thomas@gmail.com>2012-01-09 17:03:19 +0000
commit18b8dc1c2120b7d7ab6e4a7f23c33a6019e1587b (patch)
treebcd58c71118c485e61343e6233806bedd1490e51 /apps/files_texteditor/ajax
parentf7f19af8164aa78c3d1a143c40098e48f00145b8 (diff)
downloadnextcloud-server-18b8dc1c2120b7d7ab6e4a7f23c33a6019e1587b.tar.gz
nextcloud-server-18b8dc1c2120b7d7ab6e4a7f23c33a6019e1587b.zip
fixed saving bug
Diffstat (limited to 'apps/files_texteditor/ajax')
-rw-r--r--apps/files_texteditor/ajax/savefile.php13
1 files changed, 10 insertions, 3 deletions
diff --git a/apps/files_texteditor/ajax/savefile.php b/apps/files_texteditor/ajax/savefile.php
index 1e073f3ba24..3d0771ea983 100644
--- a/apps/files_texteditor/ajax/savefile.php
+++ b/apps/files_texteditor/ajax/savefile.php
@@ -40,7 +40,8 @@ if($path != '' && $mtime != '')
if($mtime != $filemtime)
{
// Then the file has changed since opening
- OC_JSON::error();
+ OC_JSON::error();
+ OC_Log::write('files_texteditor',"File: ".$path." modified since opening.",OC_Log::ERROR);
}
else
{
@@ -49,14 +50,20 @@ if($path != '' && $mtime != '')
if(OC_Filesystem::is_writeable($path))
{
OC_Filesystem::file_put_contents($path, $filecontents);
- OC_JSON::success();
+ // Clear statcache
+ clearstatcache();
+ // Get new mtime
+ $newmtime = OC_Filesystem::filemtime($path);
+ OC_JSON::success(array('data' => array('mtime' => $newmtime)));
}
else
{
// Not writeable!
OC_JSON::error(array('data' => array( 'message' => 'Insufficient permissions')));
+ OC_Log::write('files_texteditor',"User does not have permission to write to file: ".$path,OC_Log::ERROR);
}
}
} else {
- OC_JSON::error(array('data' => array( 'message' => 'File path or mtime not supplied')));
+ OC_JSON::error(array('data' => array( 'message' => 'File path or mtime not supplied')));
+ OC_Log::write('files_texteditor',"Invalid path supplied:".$path,OC_Log::ERROR);
}