sjarvela / mollify

Web document management and sharing platform.
http://www.mollify.org/
GNU General Public License v2.0
24 stars 10 forks source link

Copy folder fails #22

Open ianscotland opened 9 years ago

ianscotland commented 9 years ago

Hi copying a folder appears to fail - debug info below

MySQLi DB: ***** DB QUERY: select id, user_id, ip, time, last_access from session where id = '1557a0ccc7a350' and last_access >= 20150611215425 DB QUERY: select name, value from session_data where session_id = '1557a0ccc7a350' DB QUERY: SELECT id, name, user_type, lang, email, expiration, ua.type as auth FROM user left outer join user_auth ua on id=ua.user_id WHERE id='1' AND (expiration is null or expiration > 20150611235425) DB QUERY: select id, name, description from user where id in (SELECT user_group.group_id FROM user as user, user_group as user_group where user_group.user_id = user.id and user.id = '1') ORDER BY id ASC DB QUERY: UPDATE session set last_access=20150611235425 where id='1557a0ccc7a350' Filesystem registered: local EVENT HANDLER: registering 'filesystem/': FilesystemController VERSION: 2.6.7 SERVER: {CONTENT_LENGTH:44, HTTP_ORIGIN:http://52.16.229.134, HTTP_X_REQUESTED_WITH:XMLHttpRequest, HTTP_MOLLIFY_SESSION_ID:1557a0ccc7a350, CONTENT_TYPE:application/json, HTTP_REFERER:http://52.16.229.134/, HTTP_COOKIE:ocqfm1rcyiv8=ra91sskqusajo7isnudjr7sra1; oc3m5pp6j3oa=sppoji86hc4hffdr29tvulra45; mollify_app_session=1557a0ccc7a350, REQUEST_SCHEME:http, CONTEXT_PREFIX:, CONTEXT_DOCUMENT_ROOT:/var/www/html, SCRIPT_FILENAME:/var/www/html/backend/r.php, SERVER_PROTOCOL:HTTP/1.1, REQUEST_METHOD:POST, QUERY_STRING:, REQUEST_URI:/backend/r.php/filesystem/557a0e961e9f0/copy/, SCRIPT_NAME:/backend/r.php, PATH_INFO:/filesystem/557a0e961e9f0/copy/, PATH_TRANSLATED:/var/www/html/filesystem/557a0e961e9f0/copy/, PHP_SELF:/backend/r.php/filesystem/557a0e961e9f0/copy/, REQUEST_TIME_FLOAT:1434063265.743, REQUEST_TIME:1434063265} SETTINGS: {db:{host:localhost, type:mysql, database:prologis, user:root, password:, charset:utf8}, plugins:{FileViewerEditor:{viewers:{Image:{0:gif, 1:png, 2:jpg}, Google:{0:pdf, 1:tiff, 2:doc}, Quicktime:{0:mov, 1:mp4}, JPlayer:{0:mp3}}, previewers:{Image:{0:gif, 1:png, 2:jpg}}}, ItemDetails:{}}, timezone:Europe/London, enable_change_password:1, enable_descriptions:1, enable_thumbnails:1, debug:1, published_folders_root:/var/www/data} FEATURES: {limited_http_methods:, change_password:1, descriptions:1, user_groups:1, mail_notification:, retrieve_url:, folder_protection:, thumbnails:1, guest_mode:, file_view:1, file_preview:1, file_edit:1} FILESYSTEM: allowed_file_upload_types={} SESSION: is_active=1, user={id:1, name:admin, user_type:a, lang:, email:, expiration:, auth:}, data={auth:} AUTH: is_authenticated=1 REQUEST: method=post, path={0:filesystem, 1:557a0e961e9f0, 2:copy}, ip=80.229.217.103, params={}, data={folder:557a0e7449b5d, overwrite:} SERVICE (FilesystemServices) DB QUERY: select path from item_id where id='557a0e961e9f0' DB QUERY: SELECT id, type, name, path FROM folder where id='1' DB QUERY: select id from item_id where path='1:/' DB QUERY: select path from item_id where id='557a0e7449b5d' DB QUERY: SELECT id, type, name, path FROM folder where id='2' DB QUERY: select id from item_id where path='2:/' DB QUERY: select id from item_id where path='2:/Folder 1/' COPY TO /var/www/data/test/Folder 1/ copying 557a0e961e9f0[/var/www/data/Template/Folder 1/] to 557a0ebbd302a[/var/www/data/test/Folder 1/] DB QUERY: select id from item_id where path='2:/Folder 1/Folder 1/' copy [/var/www/data/Template/Folder 1/] -> [/var/www/data/test/Folder 1/Folder 1/] PHP error #2, mkdir(): No such file or directory (/var/www/html/backend/include/filesystem/LocalFilesystem.class.php:306) {0:{function:globalErrorHandler, args:{0:2, 1:mkdir(): No such file or directory, 2:/var/www/html/backend/include/filesystem/LocalFilesystem.class.php, 3:306, 4:{from:/var/www/data/Template/Folder 1/, to:/var/www/data/test/Folder 1/Folder 1/, dir:Resource id #3}}}, 1:{file:/var/www/html/backend/include/filesystem/LocalFilesystem.class.php, line:306, function:mkdir, args:{0:/var/www/data/test/Folder 1/Folder 1/}}, 2:{file:/var/www/html/backend/include/filesystem/LocalFilesystem.class.php, line:293, function:copyFolderRecursively, class:LocalFilesystem, object:LOCAL (1) Project Template(/var/www/data/Template/), type:->, args:{0:/var/www/data/Template/Folder 1/, 1:/var/www/data/test/Folder 1/Folder 1/}}, 3:{file:/var/www/html/backend/include/filesystem/FilesystemItem.class.php, line:84, function:copy, class:LocalFilesystem, object:LOCAL (1) Project Template(/var/www/data/Template/), type:->, args:{0:FILESYSTEMITEM Folder (LocalFilesystem): [557a0e961e9f0] = 'Folder 1' (Folder 1/), 1:FILESYSTEMITEM Folder (LocalFilesystem): [557a0ebbd42ef] = 'Folder 1' (Folder 1/Folder 1/)}}, 4:{file:/var/www/html/backend/include/filesystem/FilesystemController.class.php, line:653, function:copy, class:FilesystemItem, object:FILESYSTEMITEM Folder (LocalFilesystem): [557a0e961e9f0] = 'Folder 1' (Folder 1/), type:->, args:{0:FILESYSTEMITEM Folder (LocalFilesystem): [557a0ebbd42ef] = 'Folder 1' (Folder 1/Folder 1/)}}, 5:{file:/var/www/html/backend/include/services/FilesystemServices.class.php, line:436, function:copy, class:FilesystemController, object:FILESYSTEMCONTROLLER, type:->, args:{0:FILESYSTEMITEM Folder (LocalFilesystem): [557a0e961e9f0] = 'Folder 1' (Folder 1/), 1:FILESYSTEMITEM Folder (LocalFilesystem): [557a0ebbd302a] = 'Folder 1' (Folder 1/)}}, 6:{file:/var/www/html/backend/include/services/FilesystemServices.class.php, line:67, function:processPostFolder, class:FilesystemServices, object:FileSystemServices, type:->, args:{0:FILESYSTEMITEM Folder (LocalFilesystem): [557a0e961e9f0] = 'Folder 1' (Folder 1/)}}, 7:{file:/var/www/html/backend/include/services/ServicesBase.class.php, line:59, function:processPost, class:FilesystemServices, object:FileSystemServices, type:->, args:{}}, 8:{file:/var/www/html/backend/include/MollifyBackend.class.php, line:85, function:processRequest, class:ServicesBase, object:FileSystemServices, type:->, args:{}}, 9:{file:/var/www/html/backend/r.php, line:81, function:processRequest, class:MollifyBackend, object:MollifyBackend, type:->, args:{0:Request}}} RESPONSE error {0:999, 1:Unexpected server error, 2:500} PHP error #2, mkdir(): No such file or directory (/var/www/html/backend/include/filesystem/LocalFilesystem.class.php:306)

ianscotland commented 9 years ago

The problem is in FilesystemServices.class.php - line 423. I have corrected the code and left the commented out original code below;

case 'copy': $data = $this->request->data; if (!isset($data['folder']) and !isset($data['name'])) { throw $this->invalidRequestException(); }

            if (isset($data['folder']) and isset($data['name'])) {
                throw $this->invalidRequestException();
            }

            $name = NULL;
            if (isset($data['folder'])) {
                $to = $this->item($data['folder'], FALSE);
            } else {
                $to = $item->parent();
                $name = $data['name'];
            }
            $this->env->filesystem()->copy($item, $to, $name);
            break;

            //$data = $this->request->data;
            //if (!isset($data['folder'])) {
            //    throw $this->invalidRequestException();
            //}

            //$folder = $this->item($data['folder']);
            //$to = $folder->folderWithName($item->name());
            //Logging::logDebug("COPY TO " . $to->internalPath());
            //if ($to->exists()) {
            //    throw new ServiceException("DIR_ALREADY_EXISTS");
            //}

            //$this->env->filesystem()->copy($item, $to);
            //break;