[Owncloud] Warnings on write/modify/remove files

George Ruinelli george at ruinelli.ch
Sun Dec 2 17:29:50 UTC 2012


Hi all

I am trying to write an App which can write/modify/remove files.
I was now able to do this with the following code, but get some warnings:
----- CODE -------------------------------------
$root = "Notes";
$user = OCP\USER::getUser();

OC_Filesystem::init($root, '/' . $user . '/');
OC_Filesystem::mkdir($root);

if ( OC_Filesystem::is_dir($root) ) { echo 'OC_Filesystem is being used 
correctly'; }

OC_Files::newFile($root, "b9.txt", 'file'); //ok, but not needed

OC_Filesystem::file_put_contents($root . '/' . 'b9.txt', "aa\nbb"); //generates  
warning

print OC_Filesystem::file_get_contents($root . '/' . 'b9.txt'); //read ok

OC_Filesystem::rename($root . '/' . 'b9.txt', $root . '/' . 'b92.txt');  
//generates warning

OC_Filesystem::unlink($root . '/' . 'b92.txt'); //generates warning


----- OUTPUT -------------------------------------
OC_Filesystem is being used correctly

Notice: Undefined index: mimetype in ***/lib/filecache.php on line 359

Notice: Undefined index: id in ***/lib/filecache.php on line 371

Notice: Undefined index: mimetype in ***/lib/filecache.php on line 373
aa bb
Notice: Undefined index: id in ***/lib/filecache.php on line 371

Notice: Undefined index: mimetype in ***/lib/filecache.php on line 373

Notice: Undefined index: id in ***/lib/filecache.php on line 371

Notice: Undefined index: mimetype in ***/lib/filecache.php on line 373

Notice: Undefined index: id in ***/lib/filecache.php on line 371

Notice: Undefined index: mimetype in ***/lib/filecache.php on line 373
--------------------------------------------------

Does anybody have any explanation for this?
George



More information about the Owncloud mailing list