From 9e39118b526afe6464fc15ea3fa5ed6301f1f63d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Fri, 20 Sep 2013 16:37:07 +0200 Subject: [PATCH 1/2] namespaces use upcasefirst parts when _ is left in namespace and files are named after their classes the autoloader will also find classes in the lib folder of an app its magic! --- apps/files/ajax/delete.php | 2 +- apps/files/ajax/getstoragestats.php | 2 +- apps/files/ajax/list.php | 6 +++--- apps/files/ajax/rawlist.php | 6 +++--- apps/files/ajax/upload.php | 4 ++-- apps/files/index.php | 6 +++--- apps/files/lib/helper.php | 6 +++--- apps/files_sharing/public.php | 2 +- apps/files_trashbin/ajax/list.php | 4 ++-- apps/files_trashbin/appinfo/app.php | 4 ++-- apps/files_trashbin/index.php | 4 ++-- apps/files_trashbin/lib/helper.php | 6 +++--- apps/files_trashbin/lib/{trash.php => trashbin.php} | 0 13 files changed, 26 insertions(+), 26 deletions(-) rename apps/files_trashbin/lib/{trash.php => trashbin.php} (100%) diff --git a/apps/files/ajax/delete.php b/apps/files/ajax/delete.php index 5f4856ec79..ad79549e5e 100644 --- a/apps/files/ajax/delete.php +++ b/apps/files/ajax/delete.php @@ -24,7 +24,7 @@ foreach ($files as $file) { } // get array with updated storage stats (e.g. max file size) after upload -$storageStats = \OCA\files\lib\Helper::buildFileStorageStatistics($dir); +$storageStats = \OCA\Files\Lib\Helper::buildFileStorageStatistics($dir); if ($success) { OCP\JSON::success(array("data" => array_merge(array("dir" => $dir, "files" => $files), $storageStats))); diff --git a/apps/files/ajax/getstoragestats.php b/apps/files/ajax/getstoragestats.php index 7a2b642a9b..ace261ba76 100644 --- a/apps/files/ajax/getstoragestats.php +++ b/apps/files/ajax/getstoragestats.php @@ -6,4 +6,4 @@ $RUNTIME_APPTYPES = array('filesystem'); OCP\JSON::checkLoggedIn(); // send back json -OCP\JSON::success(array('data' => \OCA\files\lib\Helper::buildFileStorageStatistics('/'))); +OCP\JSON::success(array('data' => \OCA\Files\Lib\Helper::buildFileStorageStatistics('/'))); diff --git a/apps/files/ajax/list.php b/apps/files/ajax/list.php index f1b713b553..869c9b9e34 100644 --- a/apps/files/ajax/list.php +++ b/apps/files/ajax/list.php @@ -20,11 +20,11 @@ $doBreadcrumb = isset($_GET['breadcrumb']); $data = array(); $baseUrl = OCP\Util::linkTo('files', 'index.php') . '?dir='; -$permissions = \OCA\files\lib\Helper::getDirPermissions($dir); +$permissions = \OCA\Files\Lib\Helper::getDirPermissions($dir); // Make breadcrumb if($doBreadcrumb) { - $breadcrumb = \OCA\files\lib\Helper::makeBreadcrumb($dir); + $breadcrumb = \OCA\Files\Lib\Helper::makeBreadcrumb($dir); $breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', ''); $breadcrumbNav->assign('breadcrumb', $breadcrumb, false); @@ -34,7 +34,7 @@ if($doBreadcrumb) { } // make filelist -$files = \OCA\files\lib\Helper::getFiles($dir); +$files = \OCA\Files\Lib\Helper::getFiles($dir); $list = new OCP\Template("files", "part.list", ""); $list->assign('files', $files, false); diff --git a/apps/files/ajax/rawlist.php b/apps/files/ajax/rawlist.php index 9ccd4cc299..742da4d2da 100644 --- a/apps/files/ajax/rawlist.php +++ b/apps/files/ajax/rawlist.php @@ -28,7 +28,7 @@ if($mimetypes && !in_array('httpd/unix-directory', $mimetypes)) { $file['directory'] = $dir; $file['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($file['mimetype']); $file["date"] = OCP\Util::formatDate($file["mtime"]); - $file['mimetype_icon'] = \OCA\files\lib\Helper::determineIcon($file); + $file['mimetype_icon'] = \OCA\Files\Lib\Helper::determineIcon($file); $files[] = $file; } } @@ -39,7 +39,7 @@ if (is_array($mimetypes) && count($mimetypes)) { $file['directory'] = $dir; $file['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($file['mimetype']); $file["date"] = OCP\Util::formatDate($file["mtime"]); - $file['mimetype_icon'] = \OCA\files\lib\Helper::determineIcon($file); + $file['mimetype_icon'] = \OCA\Files\Lib\Helper::determineIcon($file); $files[] = $file; } } @@ -48,7 +48,7 @@ if (is_array($mimetypes) && count($mimetypes)) { $file['directory'] = $dir; $file['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($file['mimetype']); $file["date"] = OCP\Util::formatDate($file["mtime"]); - $file['mimetype_icon'] = \OCA\files\lib\Helper::determineIcon($file); + $file['mimetype_icon'] = \OCA\Files\Lib\Helper::determineIcon($file); $files[] = $file; } } diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php index 3d5314afc8..e07e2c07f3 100644 --- a/apps/files/ajax/upload.php +++ b/apps/files/ajax/upload.php @@ -53,7 +53,7 @@ OCP\JSON::callCheck(); // get array with current storage stats (e.g. max file size) -$storageStats = \OCA\files\lib\Helper::buildFileStorageStatistics($dir); +$storageStats = \OCA\Files\Lib\Helper::buildFileStorageStatistics($dir); if (!isset($_FILES['files'])) { OCP\JSON::error(array('data' => array_merge(array('message' => $l->t('No file was uploaded. Unknown error')), $storageStats))); @@ -113,7 +113,7 @@ if (strpos($dir, '..') === false) { if (is_uploaded_file($files['tmp_name'][$i]) and \OC\Files\Filesystem::fromTmpFile($files['tmp_name'][$i], $target)) { // updated max file size after upload - $storageStats = \OCA\files\lib\Helper::buildFileStorageStatistics($dir); + $storageStats = \OCA\Files\Lib\Helper::buildFileStorageStatistics($dir); $meta = \OC\Files\Filesystem::getFileInfo($target); if ($meta === false) { diff --git a/apps/files/index.php b/apps/files/index.php index 9e54a706c0..32c3e09cd6 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -74,14 +74,14 @@ if (\OC\Files\Cache\Upgrade::needUpgrade($user)) { //dont load anything if we ne $ajaxLoad = true; } else{ - $files = \OCA\files\lib\Helper::getFiles($dir); + $files = \OCA\Files\Lib\Helper::getFiles($dir); } $freeSpace = \OC\Files\Filesystem::free_space($dir); $needUpgrade = false; } // Make breadcrumb -$breadcrumb = \OCA\files\lib\Helper::makeBreadcrumb($dir); +$breadcrumb = \OCA\Files\Lib\Helper::makeBreadcrumb($dir); // make breadcrumb und filelist markup $list = new OCP\Template('files', 'part.list', ''); @@ -93,7 +93,7 @@ $breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', ''); $breadcrumbNav->assign('breadcrumb', $breadcrumb); $breadcrumbNav->assign('baseURL', OCP\Util::linkTo('files', 'index.php') . '?dir='); -$permissions = \OCA\files\lib\Helper::getDirPermissions($dir); +$permissions = \OCA\Files\Lib\Helper::getDirPermissions($dir); if ($needUpgrade) { OCP\Util::addscript('files', 'upgrade'); diff --git a/apps/files/lib/helper.php b/apps/files/lib/helper.php index 3c13b8ea6e..5b454127a7 100644 --- a/apps/files/lib/helper.php +++ b/apps/files/lib/helper.php @@ -1,6 +1,6 @@ assign('breadcrumb', $breadcrumb, false); @@ -26,7 +26,7 @@ if($doBreadcrumb) { } // make filelist -$files = \OCA\files_trashbin\lib\Helper::getTrashFiles($dir); +$files = \OCA\Files_Trashbin\Helper::getTrashFiles($dir); if ($files === null){ header("HTTP/1.0 404 Not Found"); diff --git a/apps/files_trashbin/appinfo/app.php b/apps/files_trashbin/appinfo/app.php index 2c101f0a72..d30a601ef5 100644 --- a/apps/files_trashbin/appinfo/app.php +++ b/apps/files_trashbin/appinfo/app.php @@ -1,7 +1,7 @@ assign('breadcrumb', $breadcrumb); diff --git a/apps/files_trashbin/lib/helper.php b/apps/files_trashbin/lib/helper.php index 098fc0b54b..1c89eaf2c2 100644 --- a/apps/files_trashbin/lib/helper.php +++ b/apps/files_trashbin/lib/helper.php @@ -1,6 +1,6 @@ Date: Fri, 20 Sep 2013 16:46:33 +0200 Subject: [PATCH 2/2] remove unneccessary lib in namespace --- apps/files/ajax/delete.php | 2 +- apps/files/ajax/getstoragestats.php | 2 +- apps/files/ajax/list.php | 6 +++--- apps/files/ajax/rawlist.php | 6 +++--- apps/files/ajax/upload.php | 4 ++-- apps/files/appinfo/app.php | 1 - apps/files/index.php | 6 +++--- apps/files/lib/helper.php | 6 +++--- apps/files_sharing/public.php | 2 +- apps/files_trashbin/lib/helper.php | 4 ++-- 10 files changed, 19 insertions(+), 20 deletions(-) diff --git a/apps/files/ajax/delete.php b/apps/files/ajax/delete.php index ad79549e5e..c69f5a8860 100644 --- a/apps/files/ajax/delete.php +++ b/apps/files/ajax/delete.php @@ -24,7 +24,7 @@ foreach ($files as $file) { } // get array with updated storage stats (e.g. max file size) after upload -$storageStats = \OCA\Files\Lib\Helper::buildFileStorageStatistics($dir); +$storageStats = \OCA\Files\Helper::buildFileStorageStatistics($dir); if ($success) { OCP\JSON::success(array("data" => array_merge(array("dir" => $dir, "files" => $files), $storageStats))); diff --git a/apps/files/ajax/getstoragestats.php b/apps/files/ajax/getstoragestats.php index ace261ba76..32a77bff6c 100644 --- a/apps/files/ajax/getstoragestats.php +++ b/apps/files/ajax/getstoragestats.php @@ -6,4 +6,4 @@ $RUNTIME_APPTYPES = array('filesystem'); OCP\JSON::checkLoggedIn(); // send back json -OCP\JSON::success(array('data' => \OCA\Files\Lib\Helper::buildFileStorageStatistics('/'))); +OCP\JSON::success(array('data' => \OCA\Files\Helper::buildFileStorageStatistics('/'))); diff --git a/apps/files/ajax/list.php b/apps/files/ajax/list.php index 869c9b9e34..350fc7fa5f 100644 --- a/apps/files/ajax/list.php +++ b/apps/files/ajax/list.php @@ -20,11 +20,11 @@ $doBreadcrumb = isset($_GET['breadcrumb']); $data = array(); $baseUrl = OCP\Util::linkTo('files', 'index.php') . '?dir='; -$permissions = \OCA\Files\Lib\Helper::getDirPermissions($dir); +$permissions = \OCA\Files\Helper::getDirPermissions($dir); // Make breadcrumb if($doBreadcrumb) { - $breadcrumb = \OCA\Files\Lib\Helper::makeBreadcrumb($dir); + $breadcrumb = \OCA\Files\Helper::makeBreadcrumb($dir); $breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', ''); $breadcrumbNav->assign('breadcrumb', $breadcrumb, false); @@ -34,7 +34,7 @@ if($doBreadcrumb) { } // make filelist -$files = \OCA\Files\Lib\Helper::getFiles($dir); +$files = \OCA\Files\Helper::getFiles($dir); $list = new OCP\Template("files", "part.list", ""); $list->assign('files', $files, false); diff --git a/apps/files/ajax/rawlist.php b/apps/files/ajax/rawlist.php index 742da4d2da..5ca0d5e811 100644 --- a/apps/files/ajax/rawlist.php +++ b/apps/files/ajax/rawlist.php @@ -28,7 +28,7 @@ if($mimetypes && !in_array('httpd/unix-directory', $mimetypes)) { $file['directory'] = $dir; $file['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($file['mimetype']); $file["date"] = OCP\Util::formatDate($file["mtime"]); - $file['mimetype_icon'] = \OCA\Files\Lib\Helper::determineIcon($file); + $file['mimetype_icon'] = \OCA\Files\Helper::determineIcon($file); $files[] = $file; } } @@ -39,7 +39,7 @@ if (is_array($mimetypes) && count($mimetypes)) { $file['directory'] = $dir; $file['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($file['mimetype']); $file["date"] = OCP\Util::formatDate($file["mtime"]); - $file['mimetype_icon'] = \OCA\Files\Lib\Helper::determineIcon($file); + $file['mimetype_icon'] = \OCA\Files\Helper::determineIcon($file); $files[] = $file; } } @@ -48,7 +48,7 @@ if (is_array($mimetypes) && count($mimetypes)) { $file['directory'] = $dir; $file['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($file['mimetype']); $file["date"] = OCP\Util::formatDate($file["mtime"]); - $file['mimetype_icon'] = \OCA\Files\Lib\Helper::determineIcon($file); + $file['mimetype_icon'] = \OCA\Files\Helper::determineIcon($file); $files[] = $file; } } diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php index e07e2c07f3..0920bf6210 100644 --- a/apps/files/ajax/upload.php +++ b/apps/files/ajax/upload.php @@ -53,7 +53,7 @@ OCP\JSON::callCheck(); // get array with current storage stats (e.g. max file size) -$storageStats = \OCA\Files\Lib\Helper::buildFileStorageStatistics($dir); +$storageStats = \OCA\Files\Helper::buildFileStorageStatistics($dir); if (!isset($_FILES['files'])) { OCP\JSON::error(array('data' => array_merge(array('message' => $l->t('No file was uploaded. Unknown error')), $storageStats))); @@ -113,7 +113,7 @@ if (strpos($dir, '..') === false) { if (is_uploaded_file($files['tmp_name'][$i]) and \OC\Files\Filesystem::fromTmpFile($files['tmp_name'][$i], $target)) { // updated max file size after upload - $storageStats = \OCA\Files\Lib\Helper::buildFileStorageStatistics($dir); + $storageStats = \OCA\Files\Helper::buildFileStorageStatistics($dir); $meta = \OC\Files\Filesystem::getFileInfo($target); if ($meta === false) { diff --git a/apps/files/appinfo/app.php b/apps/files/appinfo/app.php index bd3245ded3..909baca92e 100644 --- a/apps/files/appinfo/app.php +++ b/apps/files/appinfo/app.php @@ -1,5 +1,4 @@ assign('breadcrumb', $breadcrumb); $breadcrumbNav->assign('baseURL', OCP\Util::linkTo('files', 'index.php') . '?dir='); -$permissions = \OCA\Files\Lib\Helper::getDirPermissions($dir); +$permissions = \OCA\Files\Helper::getDirPermissions($dir); if ($needUpgrade) { OCP\Util::addscript('files', 'upgrade'); diff --git a/apps/files/lib/helper.php b/apps/files/lib/helper.php index 5b454127a7..08c807d7f7 100644 --- a/apps/files/lib/helper.php +++ b/apps/files/lib/helper.php @@ -1,6 +1,6 @@