From afbe50d09c7d9e5cbed2a09bc915ba4eaa8ced27 Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Thu, 6 Feb 2014 09:44:13 +0100 Subject: remove global variable $RUNTIME_NOAPPS - it's just superfluous --- core/command/upgrade.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'core/command') diff --git a/core/command/upgrade.php b/core/command/upgrade.php index 1d105b67a06..2eded15e9fe 100644 --- a/core/command/upgrade.php +++ b/core/command/upgrade.php @@ -30,9 +30,6 @@ class Upgrade extends Command { } protected function execute(InputInterface $input, OutputInterface $output) { - global $RUNTIME_NOAPPS; - - $RUNTIME_NOAPPS = true; //no apps, yet require_once \OC::$SERVERROOT . '/lib/base.php'; -- cgit v1.2.3 From 79fc4f312604feb20f96378d052703ec4768ecad Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Thu, 6 Feb 2014 11:34:27 +0100 Subject: Within OC:init() the minimum set of apps is loaded - which is filesystem, authentication and logging --- apps/files/appinfo/remote.php | 6 ------ core/command/user/report.php | 3 +-- lib/base.php | 15 ++++----------- lib/private/user.php | 2 -- 4 files changed, 5 insertions(+), 21 deletions(-) (limited to 'core/command') diff --git a/apps/files/appinfo/remote.php b/apps/files/appinfo/remote.php index ef22fe92188..8d762d4e880 100644 --- a/apps/files/appinfo/remote.php +++ b/apps/files/appinfo/remote.php @@ -22,12 +22,6 @@ * License along with this library. If not, see . * */ -// load needed apps -$RUNTIME_APPTYPES = array('filesystem', 'authentication', 'logging'); - -OC_App::loadApps($RUNTIME_APPTYPES); - -OC_Util::obEnd(); // Backends $authBackend = new OC_Connector_Sabre_Auth(); diff --git a/core/command/user/report.php b/core/command/user/report.php index f95ba251bcc..d6b7abacabc 100644 --- a/core/command/user/report.php +++ b/core/command/user/report.php @@ -48,7 +48,6 @@ class Report extends Command { } private function countUsers() { - \OC_App::loadApps(array('authentication')); $userManager = \OC::$server->getUserManager(); return $userManager->countUsers(); } @@ -58,4 +57,4 @@ class Report extends Command { $userDirectories = $dataview->getDirectoryContent('/', 'httpd/unix-directory'); return count($userDirectories); } -} \ No newline at end of file +} diff --git a/lib/base.php b/lib/base.php index 18adfd31204..fb7baf86a59 100644 --- a/lib/base.php +++ b/lib/base.php @@ -567,15 +567,9 @@ class OC { OC_User::logout(); } - // Load Apps - // This includes plugins for users and filesystems as well - global $RUNTIME_APPTYPES; + // Load minimum set of apps - which is filesystem, authentication and logging if (!self::checkUpgrade(false)) { - if ($RUNTIME_APPTYPES) { - OC_App::loadApps($RUNTIME_APPTYPES); - } else { - OC_App::loadApps(); - } + OC_App::loadApps(array('filesystem', 'authentication', 'logging')); } //setup extra user backends @@ -866,7 +860,7 @@ class OC { ) { return false; } - OC_App::loadApps(array('authentication')); + if (defined("DEBUG") && DEBUG) { OC_Log::write('core', 'Trying to login from cookie', OC_Log::DEBUG); } @@ -938,7 +932,7 @@ class OC { ) { return false; } - OC_App::loadApps(array('authentication')); + if (OC_User::login($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) { //OC_Log::write('core',"Logged in with HTTP Authentication", OC_Log::DEBUG); OC_User::unsetMagicInCookie(); @@ -967,4 +961,3 @@ if (!function_exists('get_temp_dir')) { } OC::init(); - diff --git a/lib/private/user.php b/lib/private/user.php index 98ebebbe5c1..11f96aabf74 100644 --- a/lib/private/user.php +++ b/lib/private/user.php @@ -317,8 +317,6 @@ class OC_User { */ public static function isLoggedIn() { if (\OC::$session->get('user_id') && self::$incognitoMode === false) { - OC_App::loadApps(array('authentication')); - self::setupBackends(); return self::userExists(\OC::$session->get('user_id')); } return false; -- cgit v1.2.3 From adaee6a5a19a4b0050d189736bd4e6183fee9cf0 Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Wed, 19 Feb 2014 09:31:54 +0100 Subject: Scrutinizer Auto-Fixes This patch was automatically generated as part of the following inspection: https://scrutinizer-ci.com/g/owncloud/core/inspections/cdfecc4e-a37e-4233-8025-f0d7252a8720 Enabled analysis tools: - PHP Analyzer - JSHint - PHP Copy/Paste Detector - PHP PDepend --- apps/files_encryption/lib/helper.php | 2 +- apps/files_external/lib/google.php | 2 +- apps/files_external/lib/streamwrapper.php | 1 + apps/files_external/lib/webdav.php | 3 +++ apps/files_sharing/lib/cache.php | 2 +- apps/files_sharing/lib/sharedstorage.php | 1 + apps/files_versions/lib/versions.php | 4 ++-- apps/user_ldap/lib/access.php | 12 ++++++++-- apps/user_ldap/lib/connection.php | 3 +++ apps/user_ldap/lib/proxy.php | 8 +++++++ apps/user_ldap/lib/wizard.php | 8 +++---- apps/user_ldap/user_ldap.php | 3 +-- core/command/db/generatechangescript.php | 1 - core/command/status.php | 2 -- core/command/upgrade.php | 2 -- core/command/user/report.php | 2 -- lib/private/app.php | 2 ++ lib/private/appconfig.php | 7 ++++-- lib/private/appframework/app.php | 1 - .../dependencyinjection/dicontainer.php | 1 - lib/private/appframework/http/redirectresponse.php | 4 ++-- .../middleware/middlewaredispatcher.php | 1 - .../middleware/security/securitymiddleware.php | 2 +- lib/private/archive.php | 1 - lib/private/archive/tar.php | 6 +++++ lib/private/archive/zip.php | 4 +++- lib/private/arrayparser.php | 3 +++ lib/private/backgroundjob.php | 2 +- lib/private/backgroundjob/joblist.php | 2 +- lib/private/cache/usercache.php | 2 +- lib/private/config.php | 4 ++-- .../sabre/aborteduploaddetectionplugin.php | 2 +- lib/private/connector/sabre/quotaplugin.php | 1 + lib/private/db.php | 3 ++- lib/private/db/mdb2schemawriter.php | 6 +++++ lib/private/filechunking.php | 2 +- lib/private/fileproxy.php | 1 + lib/private/files.php | 3 +++ lib/private/files/cache/updater.php | 2 -- lib/private/files/fileinfo.php | 4 ++++ lib/private/files/filesystem.php | 3 +++ lib/private/files/node/folder.php | 1 - lib/private/files/node/node.php | 2 -- lib/private/files/node/root.php | 1 - lib/private/files/storage/loader.php | 3 +++ lib/private/files/storage/mappedlocal.php | 6 +++++ lib/private/files/utils/scanner.php | 3 +++ lib/private/geo.php | 4 ++++ lib/private/group.php | 2 +- lib/private/group/dummy.php | 2 +- lib/private/image.php | 9 ++++---- lib/private/installer.php | 27 +--------------------- lib/private/l10n.php | 3 +++ lib/private/legacy/appconfig.php | 2 ++ lib/private/legacy/preferences.php | 2 +- lib/private/migrate.php | 3 ++- lib/private/migration/content.php | 8 +++---- lib/private/migration/provider.php | 2 +- lib/private/ocs.php | 5 +--- lib/private/preferences.php | 2 +- lib/private/request.php | 2 +- lib/private/share/searchresultsorter.php | 4 ++-- lib/private/template/base.php | 4 ++++ lib/private/template/templatefilelocator.php | 1 + lib/private/user.php | 2 ++ lib/private/user/database.php | 2 +- lib/private/util.php | 5 ++-- lib/public/appframework/controller.php | 4 ++-- lib/public/backgroundjob.php | 4 ++-- lib/public/backgroundjob/ijob.php | 1 + lib/public/backgroundjob/ijoblist.php | 7 +++++- lib/public/contacts/imanager.php | 4 ++-- lib/public/files.php | 1 - lib/public/iappconfig.php | 2 ++ lib/public/iconfig.php | 2 +- lib/public/itags.php | 4 ++-- lib/public/share.php | 13 +++++++++++ tests/lib/api.php | 8 +++++++ tests/lib/appframework/http/DispatcherTest.php | 5 +++- tests/lib/appframework/http/ResponseTest.php | 4 ++-- .../middleware/MiddlewareDispatcherTest.php | 3 +++ .../middleware/security/SecurityMiddlewareTest.php | 11 +++++++++ tests/lib/appframework/routing/RoutingTest.php | 13 +++++++++++ tests/lib/dbschema.php | 6 +++++ tests/lib/errorHandler.php | 4 ++++ tests/lib/files/cache/homecache.php | 4 ++++ tests/lib/files/etagtest.php | 3 +++ tests/lib/files/node/integration.php | 3 --- tests/lib/files/node/root.php | 1 - tests/lib/files/storage/home.php | 4 ++++ tests/lib/files/storage/wrapper/quota.php | 3 +++ tests/lib/files/stream/quota.php | 4 ++++ tests/lib/group/backend.php | 4 ++-- tests/lib/group/database.php | 4 ++-- tests/lib/group/group.php | 2 +- tests/lib/migrate.php | 1 + tests/lib/ocs/privatedata.php | 1 + tests/lib/share/share.php | 7 ++++++ tests/lib/template/resourcelocator.php | 5 ++++ tests/lib/user.php | 2 -- tests/testcleanuplistener.php | 3 +++ 101 files changed, 260 insertions(+), 119 deletions(-) (limited to 'core/command') diff --git a/apps/files_encryption/lib/helper.php b/apps/files_encryption/lib/helper.php index 5ec09629d62..ef3775875f0 100755 --- a/apps/files_encryption/lib/helper.php +++ b/apps/files_encryption/lib/helper.php @@ -425,7 +425,7 @@ class Helper { /** * @brief glob uses different pattern than regular expressions, escape glob pattern only * @param string $path unescaped path - * @return escaped path + * @return string path */ public static function escapeGlobPattern($path) { return preg_replace('/(\*|\?|\[)/', '[$1]', $path); diff --git a/apps/files_external/lib/google.php b/apps/files_external/lib/google.php index 064c1e20a93..35457f68528 100644 --- a/apps/files_external/lib/google.php +++ b/apps/files_external/lib/google.php @@ -67,7 +67,7 @@ class Google extends \OC\Files\Storage\Common { /** * Get the Google_DriveFile object for the specified path * @param string $path - * @return Google_DriveFile|false + * @return string */ private function getDriveFile($path) { // Remove leading and trailing slashes diff --git a/apps/files_external/lib/streamwrapper.php b/apps/files_external/lib/streamwrapper.php index 3e3dc3e3af5..44bd9a0161a 100644 --- a/apps/files_external/lib/streamwrapper.php +++ b/apps/files_external/lib/streamwrapper.php @@ -11,6 +11,7 @@ namespace OC\Files\Storage; abstract class StreamWrapper extends Common { /** + * @param string $path * @return string|null */ abstract public function constructUrl($path); diff --git a/apps/files_external/lib/webdav.php b/apps/files_external/lib/webdav.php index c64b2d8b73a..7611316a26a 100644 --- a/apps/files_external/lib/webdav.php +++ b/apps/files_external/lib/webdav.php @@ -336,6 +336,9 @@ class DAV extends \OC\Files\Storage\Common{ } } + /** + * @param string $path + */ public function cleanPath($path) { $path = \OC\Files\Filesystem::normalizePath($path); // remove leading slash diff --git a/apps/files_sharing/lib/cache.php b/apps/files_sharing/lib/cache.php index 7d63e7a4fe3..aadc54e4a7f 100644 --- a/apps/files_sharing/lib/cache.php +++ b/apps/files_sharing/lib/cache.php @@ -396,7 +396,7 @@ class Shared_Cache extends Cache { * use the one with the highest id gives the best result with the background scanner, since that is most * likely the folder where we stopped scanning previously * - * @return string|bool the path of the folder or false when no folder matched + * @return boolean the path of the folder or false when no folder matched */ public function getIncomplete() { return false; diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php index ebd16f081ba..b922654e5ec 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/sharedstorage.php @@ -41,6 +41,7 @@ class Shared extends \OC\Files\Storage\Common { /** * @brief Get the source file path, permissions, and owner for a shared file * @param string Shared target file path + * @param string $target * @return Returns array with the keys path, permissions, and owner or false if not found */ public function getFile($target) { diff --git a/apps/files_versions/lib/versions.php b/apps/files_versions/lib/versions.php index fc0bf3bfad0..2bd9c15bae4 100644 --- a/apps/files_versions/lib/versions.php +++ b/apps/files_versions/lib/versions.php @@ -336,7 +336,7 @@ class Storage { * @brief deletes used space for files versions in db if user was deleted * * @param type $uid id of deleted user - * @return result of db delete operation + * @return \OC_DB_StatementWrapper of db delete operation */ public static function deleteUser($uid) { $query = \OC_DB::prepare('DELETE FROM `*PREFIX*files_versions` WHERE `user`=?'); @@ -420,8 +420,8 @@ class Storage { /** * @brief get list of files we want to expire - * @param integer $currentTime timestamp of current time * @param array $versions list of versions + * @param integer $time * @return array containing the list of to deleted versions and the size of them */ protected static function getExpireList($time, $versions) { diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php index 8a8d8aa5e3a..6795aecafee 100644 --- a/apps/user_ldap/lib/access.php +++ b/apps/user_ldap/lib/access.php @@ -164,6 +164,7 @@ class Access extends LDAPUtility { /** * gives back the database table for the query + * @param boolean $isUser */ private function getMapTable($isUser) { if($isUser) { @@ -644,6 +645,8 @@ class Access extends LDAPUtility { * @brief executes an LDAP search, optimized for Users * @param $filter the LDAP filter for the search * @param $attr optional, when a certain attribute shall be filtered out + * @param integer $limit + * @param integer $offset * @returns array with the search result * * Executes an LDAP search @@ -661,8 +664,10 @@ class Access extends LDAPUtility { /** * @brief executes an LDAP search, optimized for Groups - * @param $filter the LDAP filter for the search + * @param string $filter the LDAP filter for the search * @param $attr optional, when a certain attribute shall be filtered out + * @param integer $limit + * @param integer $offset * @returns array with the search result * * Executes an LDAP search @@ -757,7 +762,7 @@ class Access extends LDAPUtility { /** * @brief executes an LDAP search, but counts the results only - * @param $filter the LDAP filter for the search + * @param string $filter the LDAP filter for the search * @param $base an array containing the LDAP subtree(s) that shall be searched * @param $attr optional, array, one or more attributes that shall be * retrieved. Results will according to the order in the array. @@ -1006,6 +1011,9 @@ class Access extends LDAPUtility { return $this->combineFilterWithOr($filter); } + /** + * @param string $password + */ public function areCredentialsValid($name, $password) { $name = $this->DNasBaseParameter($name); $testConnection = clone $this->connection; diff --git a/apps/user_ldap/lib/connection.php b/apps/user_ldap/lib/connection.php index 19870550163..b2075748a3b 100644 --- a/apps/user_ldap/lib/connection.php +++ b/apps/user_ldap/lib/connection.php @@ -159,6 +159,9 @@ class Connection extends LDAPUtility { return unserialize(base64_decode($this->cache->get($key))); } + /** + * @param string $key + */ public function isCached($key) { if(!$this->configured) { $this->readConfiguration(); diff --git a/apps/user_ldap/lib/proxy.php b/apps/user_ldap/lib/proxy.php index b68910ff97f..b27233bcd19 100644 --- a/apps/user_ldap/lib/proxy.php +++ b/apps/user_ldap/lib/proxy.php @@ -56,8 +56,13 @@ abstract class Proxy { /** * @param boolean $passOnWhen + * @param string $method */ abstract protected function callOnLastSeenOn($id, $method, $parameters, $passOnWhen); + + /** + * @param string $method + */ abstract protected function walkBackends($id, $method, $parameters); /** @@ -95,6 +100,9 @@ abstract class Proxy { return unserialize(base64_decode($this->cache->get($key))); } + /** + * @param string $key + */ public function isCached($key) { $key = $this->getCacheKey($key); return $this->cache->hasKey($key); diff --git a/apps/user_ldap/lib/wizard.php b/apps/user_ldap/lib/wizard.php index 5079642d954..e79090febc1 100644 --- a/apps/user_ldap/lib/wizard.php +++ b/apps/user_ldap/lib/wizard.php @@ -865,8 +865,8 @@ class Wizard extends LDAPUtility { /** * @brief does a cumulativeSearch on LDAP to get different values of a * specified attribute - * @param $filters array, the filters that shall be used in the search - * @param $attr the attribute of which a list of values shall be returned + * @param string[] $filters array, the filters that shall be used in the search + * @param string $attr the attribute of which a list of values shall be returned * @param $lfw bool, whether the last filter is a wildcard which shall not * be processed if there were already findings, defaults to true * @param string $maxF string. if not null, this variable will have the filter that @@ -933,8 +933,8 @@ class Wizard extends LDAPUtility { * @brief determines if and which $attr are available on the LDAP server * @param string[] $objectclasses the objectclasses to use as search filter * @param string $attr the attribute to look for - * @param $dbkey the dbkey of the setting the feature is connected to - * @param $confkey the confkey counterpart for the $dbkey as used in the + * @param string $dbkey the dbkey of the setting the feature is connected to + * @param string $confkey the confkey counterpart for the $dbkey as used in the * Configuration class * @param $po boolean, whether the objectClass with most result entries * shall be pre-selected via the result diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php index 1088dafab71..4a147cf9884 100644 --- a/apps/user_ldap/user_ldap.php +++ b/apps/user_ldap/user_ldap.php @@ -25,7 +25,6 @@ namespace OCA\user_ldap; -use OCA\user_ldap\lib\ILDAPWrapper; use OCA\user_ldap\lib\BackendUtility; class USER_LDAP extends BackendUtility implements \OCP\UserInterface { @@ -139,7 +138,7 @@ class USER_LDAP extends BackendUtility implements \OCP\UserInterface { * @brief reads the image from LDAP that shall be used as Avatar * @param $uid string, the ownCloud user name * @param $dn string, the user DN - * @return image data (provided by LDAP) | false + * @return string data (provided by LDAP) | false */ private function getAvatarImage($uid, $dn) { $attributes = array('jpegPhoto', 'thumbnailPhoto'); diff --git a/core/command/db/generatechangescript.php b/core/command/db/generatechangescript.php index f971124cfdc..a4d710aa974 100644 --- a/core/command/db/generatechangescript.php +++ b/core/command/db/generatechangescript.php @@ -11,7 +11,6 @@ namespace OC\Core\Command\Db; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class GenerateChangeScript extends Command { diff --git a/core/command/status.php b/core/command/status.php index ea9825b0f61..6bc1dba44aa 100644 --- a/core/command/status.php +++ b/core/command/status.php @@ -9,9 +9,7 @@ namespace OC\Core\Command; use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class Status extends Command { diff --git a/core/command/upgrade.php b/core/command/upgrade.php index 1d105b67a06..128d27aa3db 100644 --- a/core/command/upgrade.php +++ b/core/command/upgrade.php @@ -10,9 +10,7 @@ namespace OC\Core\Command; use OC\Updater; use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class Upgrade extends Command { diff --git a/core/command/user/report.php b/core/command/user/report.php index f95ba251bcc..70c5a8566b7 100644 --- a/core/command/user/report.php +++ b/core/command/user/report.php @@ -9,10 +9,8 @@ namespace OC\Core\Command\User; use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Helper\TableHelper; class Report extends Command { protected function configure() { diff --git a/lib/private/app.php b/lib/private/app.php index e60a8a4e0b1..47f983cce35 100644 --- a/lib/private/app.php +++ b/lib/private/app.php @@ -640,6 +640,8 @@ class OC_App{ /** * register an admin form to be shown + * @param string $app + * @param string $page */ public static function registerAdmin($app, $page) { self::$adminForms[]= $app.'/'.$page.'.php'; diff --git a/lib/private/appconfig.php b/lib/private/appconfig.php index a32c1126c7b..cdaaebb87e5 100644 --- a/lib/private/appconfig.php +++ b/lib/private/appconfig.php @@ -69,6 +69,9 @@ class AppConfig implements \OCP\IAppConfig { return $this->cache[$app]; } + /** + * @param string $app + */ private function getAppValues($app) { $appCache = $this->getAppCache($app); if (array_search($app, $this->appsLoaded) === false) { @@ -184,7 +187,7 @@ class AppConfig implements \OCP\IAppConfig { * @brief Deletes a key * @param string $app app * @param string $key key - * @return bool + * @return boolean|null */ public function deleteKey($app, $key) { $where = array( @@ -200,7 +203,7 @@ class AppConfig implements \OCP\IAppConfig { /** * @brief Remove app from appconfig * @param string $app app - * @return bool + * @return boolean|null * * Removes all keys in appconfig belonging to the app. */ diff --git a/lib/private/appframework/app.php b/lib/private/appframework/app.php index b835188661a..3b13194862d 100644 --- a/lib/private/appframework/app.php +++ b/lib/private/appframework/app.php @@ -25,7 +25,6 @@ namespace OC\AppFramework; use OC\AppFramework\DependencyInjection\DIContainer; -use OCP\AppFramework\IAppContainer; /** diff --git a/lib/private/appframework/dependencyinjection/dicontainer.php b/lib/private/appframework/dependencyinjection/dicontainer.php index b6ccf60db4b..4821ecaf67b 100644 --- a/lib/private/appframework/dependencyinjection/dicontainer.php +++ b/lib/private/appframework/dependencyinjection/dicontainer.php @@ -34,7 +34,6 @@ use OC\AppFramework\Utility\SimpleContainer; use OC\AppFramework\Utility\TimeFactory; use OCP\AppFramework\IApi; use OCP\AppFramework\IAppContainer; -use OCP\AppFramework\IMiddleWare; use OCP\AppFramework\Middleware; use OCP\IServerContainer; diff --git a/lib/private/appframework/http/redirectresponse.php b/lib/private/appframework/http/redirectresponse.php index 5c4e1c06dc3..05353349065 100644 --- a/lib/private/appframework/http/redirectresponse.php +++ b/lib/private/appframework/http/redirectresponse.php @@ -24,8 +24,8 @@ namespace OC\AppFramework\Http; -use OCP\AppFramework\Http\Response, - OCP\AppFramework\Http; +use OCP\AppFramework\Http\Response; +use OCP\AppFramework\Http; /** diff --git a/lib/private/appframework/middleware/middlewaredispatcher.php b/lib/private/appframework/middleware/middlewaredispatcher.php index 598743e523f..2a715598fc4 100644 --- a/lib/private/appframework/middleware/middlewaredispatcher.php +++ b/lib/private/appframework/middleware/middlewaredispatcher.php @@ -26,7 +26,6 @@ namespace OC\AppFramework\Middleware; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\Response; -use OCP\AppFramework\MiddleWare; /** * This class is used to store and run all the middleware in correct order diff --git a/lib/private/appframework/middleware/security/securitymiddleware.php b/lib/private/appframework/middleware/security/securitymiddleware.php index c3143754823..bb02d565fa4 100644 --- a/lib/private/appframework/middleware/security/securitymiddleware.php +++ b/lib/private/appframework/middleware/security/securitymiddleware.php @@ -66,7 +66,7 @@ class SecurityMiddleware extends Middleware { * This runs all the security checks before a method call. The * security checks are determined by inspecting the controller method * annotations - * @param string/Controller $controller the controllername or string + * @param string $controller the controllername or string * @param string $methodName the name of the method * @throws SecurityException when a security check fails */ diff --git a/lib/private/archive.php b/lib/private/archive.php index a18f8d3ffbd..6f51066ddf8 100644 --- a/lib/private/archive.php +++ b/lib/private/archive.php @@ -88,7 +88,6 @@ abstract class OC_Archive{ abstract function extractFile($path, $dest); /** * extract the archive - * @param string $path * @param string $dest * @return bool */ diff --git a/lib/private/archive/tar.php b/lib/private/archive/tar.php index 5538e027ab4..cbdb565ba35 100644 --- a/lib/private/archive/tar.php +++ b/lib/private/archive/tar.php @@ -22,6 +22,9 @@ class OC_Archive_TAR extends OC_Archive{ private $tar=null; private $path; + /** + * @param string $source + */ function __construct($source) { $types=array(null, 'gz', 'bz'); $this->path=$source; @@ -122,6 +125,9 @@ class OC_Archive_TAR extends OC_Archive{ return true; } + /** + * @param string $file + */ private function getHeader($file) { if ( ! $this->cachedHeaders ) { $this->cachedHeaders = $this->tar->listContent(); diff --git a/lib/private/archive/zip.php b/lib/private/archive/zip.php index cd5479299a1..fa5630d7665 100644 --- a/lib/private/archive/zip.php +++ b/lib/private/archive/zip.php @@ -13,6 +13,9 @@ class OC_Archive_ZIP extends OC_Archive{ private $zip=null; private $path; + /** + * @param string $source + */ function __construct($source) { $this->path=$source; $this->zip=new ZipArchive(); @@ -125,7 +128,6 @@ class OC_Archive_ZIP extends OC_Archive{ } /** * extract the archive - * @param string $path * @param string $dest * @return bool */ diff --git a/lib/private/arrayparser.php b/lib/private/arrayparser.php index c4ad1264fbb..d353e486577 100644 --- a/lib/private/arrayparser.php +++ b/lib/private/arrayparser.php @@ -39,6 +39,9 @@ class ArrayParser { return $this->parse($string); } + /** + * @param string $string + */ function stripPHPTags($string) { $string = trim($string); if (substr($string, 0, 5) === 'addChild('name', $column->getName()); switch($column->getType()) { @@ -114,6 +117,9 @@ class OC_DB_MDB2SchemaWriter { } } + /** + * @param SimpleXMLElement $xml + */ private static function saveIndex($index, $xml) { $xml->addChild('name', $index->getName()); if ($index->isPrimary()) { diff --git a/lib/private/filechunking.php b/lib/private/filechunking.php index 09b30af48b2..be7f4e14a11 100644 --- a/lib/private/filechunking.php +++ b/lib/private/filechunking.php @@ -41,7 +41,7 @@ class OC_FileChunking { * Stores the given $data under the given $key - the number of stored bytes is returned * * @param string $index - * @param $data + * @param resource $data * @return int */ public function store($index, $data) { diff --git a/lib/private/fileproxy.php b/lib/private/fileproxy.php index 62187e1ec74..88976c1b8e5 100644 --- a/lib/private/fileproxy.php +++ b/lib/private/fileproxy.php @@ -110,6 +110,7 @@ class OC_FileProxy{ /** * @param string $operation + * @param string|boolean $path * * @return string */ diff --git a/lib/private/files.php b/lib/private/files.php index 4a6b9d8ca0e..6a6916537d4 100644 --- a/lib/private/files.php +++ b/lib/private/files.php @@ -32,6 +32,9 @@ class OC_Files { return \OC\Files\Filesystem::getFileInfo($path, $includeMountPoints); } + /** + * @param string $path + */ static public function getDirectoryContent($path){ return \OC\Files\Filesystem::getDirectoryContent($path); } diff --git a/lib/private/files/cache/updater.php b/lib/private/files/cache/updater.php index e4114e572fe..7a45b9e9e96 100644 --- a/lib/private/files/cache/updater.php +++ b/lib/private/files/cache/updater.php @@ -8,8 +8,6 @@ namespace OC\Files\Cache; -use OCP\Util; - /** * listen to filesystem hooks and change the cache accordingly */ diff --git a/lib/private/files/fileinfo.php b/lib/private/files/fileinfo.php index c77571cd2a7..2dbdd80a26b 100644 --- a/lib/private/files/fileinfo.php +++ b/lib/private/files/fileinfo.php @@ -29,6 +29,10 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { */ private $internalPath; + /** + * @param string|boolean $path + * @param Storage\Storage $storage + */ public function __construct($path, $storage, $internalPath, $data) { $this->path = $path; $this->storage = $storage; diff --git a/lib/private/files/filesystem.php b/lib/private/files/filesystem.php index d1ebad3490c..0face6aa3bb 100644 --- a/lib/private/files/filesystem.php +++ b/lib/private/files/filesystem.php @@ -668,6 +668,9 @@ class Filesystem { return self::$defaultInstance->search($query); } + /** + * @param string $query + */ static public function searchByMime($query) { return self::$defaultInstance->searchByMime($query); } diff --git a/lib/private/files/node/folder.php b/lib/private/files/node/folder.php index 923f53821b2..d9e0ddc2d61 100644 --- a/lib/private/files/node/folder.php +++ b/lib/private/files/node/folder.php @@ -9,7 +9,6 @@ namespace OC\Files\Node; use OC\Files\Cache\Cache; -use OC\Files\Cache\Scanner; use OCP\Files\NotFoundException; use OCP\Files\NotPermittedException; diff --git a/lib/private/files/node/node.php b/lib/private/files/node/node.php index 643a587dfc2..bc075911749 100644 --- a/lib/private/files/node/node.php +++ b/lib/private/files/node/node.php @@ -8,8 +8,6 @@ namespace OC\Files\Node; -use OC\Files\Cache\Cache; -use OC\Files\Cache\Scanner; use OCP\Files\NotFoundException; use OCP\Files\NotPermittedException; diff --git a/lib/private/files/node/root.php b/lib/private/files/node/root.php index a22a2aaf4e9..70135285b0d 100644 --- a/lib/private/files/node/root.php +++ b/lib/private/files/node/root.php @@ -9,7 +9,6 @@ namespace OC\Files\Node; use OC\Files\Cache\Cache; -use OC\Files\Cache\Scanner; use OC\Files\Mount\Manager; use OC\Files\Mount\Mount; use OCP\Files\NotFoundException; diff --git a/lib/private/files/storage/loader.php b/lib/private/files/storage/loader.php index 734131261c8..966234cb04d 100644 --- a/lib/private/files/storage/loader.php +++ b/lib/private/files/storage/loader.php @@ -33,6 +33,9 @@ class Loader { return $this->wrap($mountPoint, new $class($arguments)); } + /** + * @param string|boolean $mountPoint + */ public function wrap($mountPoint, $storage) { foreach ($this->storageWrappers as $wrapper) { $storage = $wrapper($mountPoint, $storage); diff --git a/lib/private/files/storage/mappedlocal.php b/lib/private/files/storage/mappedlocal.php index c8b22cfb39f..1bab3489a28 100644 --- a/lib/private/files/storage/mappedlocal.php +++ b/lib/private/files/storage/mappedlocal.php @@ -326,12 +326,18 @@ class MappedLocal extends \OC\Files\Storage\Common{ return $this->filemtime($path)>$time; } + /** + * @param string $path + */ private function buildPath($path, $create=true) { $path = $this->stripLeading($path); $fullPath = $this->datadir.$path; return $this->mapper->logicToPhysical($fullPath, $create); } + /** + * @param string $path + */ private function cleanMapper($path, $isLogicPath=true, $recursive=true) { $fullPath = $path; if ($isLogicPath) { diff --git a/lib/private/files/utils/scanner.php b/lib/private/files/utils/scanner.php index 558bc60cf06..a802a8fcb8b 100644 --- a/lib/private/files/utils/scanner.php +++ b/lib/private/files/utils/scanner.php @@ -69,6 +69,9 @@ class Scanner extends PublicEmitter { }); } + /** + * @param string $dir + */ public function backgroundScan($dir) { $mounts = $this->getMounts($dir); foreach ($mounts as $mount) { diff --git a/lib/private/geo.php b/lib/private/geo.php index ed01ad0b616..7094d885af6 100644 --- a/lib/private/geo.php +++ b/lib/private/geo.php @@ -12,6 +12,10 @@ class OC_Geo{ * @param (string) $longitude - Longitude * @return (string) $timezone - closest timezone */ + /** + * @param integer $latitude + * @param integer $longitude + */ public static function timezone($latitude, $longitude) { $alltimezones = DateTimeZone::listIdentifiers(); $variances = array(); diff --git a/lib/private/group.php b/lib/private/group.php index 444788c97f1..4c187b538af 100644 --- a/lib/private/group.php +++ b/lib/private/group.php @@ -243,7 +243,7 @@ class OC_Group { /** * @brief get a list of all users in several groups - * @param array $gids + * @param string[] $gids * @param string $search * @param int $limit * @param int $offset diff --git a/lib/private/group/dummy.php b/lib/private/group/dummy.php index 9516fd52ff8..da26e1b910e 100644 --- a/lib/private/group/dummy.php +++ b/lib/private/group/dummy.php @@ -28,7 +28,7 @@ class OC_Group_Dummy extends OC_Group_Backend { private $groups=array(); /** * @brief Try to create a new group - * @param $gid The name of the group to create + * @param string $gid The name of the group to create * @returns true/false * * Trys to create a new group. If the group name already exists, false will diff --git a/lib/private/image.php b/lib/private/image.php index 42afa35ea56..42685ddab5c 100644 --- a/lib/private/image.php +++ b/lib/private/image.php @@ -34,7 +34,7 @@ class OC_Image { /** * @brief Get mime type for an image file. - * @param $filepath The path to a local image file. + * @param string|null $filepath The path to a local image file. * @returns string The mime type if the it could be determined, otherwise an empty string. */ static public function getMimeTypeForFile($filePath) { @@ -163,6 +163,7 @@ class OC_Image { /** * @brief Saves the image. * @returns bool + * @param string $filePath */ public function save($filePath=null) { @@ -704,7 +705,7 @@ class OC_Image { /** * @brief Resizes the image preserving ratio. - * @param integer $maxsize The maximum size of either the width or height. + * @param integer $maxSize The maximum size of either the width or height. * @returns bool */ public function resize($maxSize) { @@ -852,8 +853,8 @@ class OC_Image { /** * @brief Resizes the image to fit within a boundry while preserving ratio. - * @param $maxWidth - * @param $maxHeight + * @param integer $maxWidth + * @param integer $maxHeight * @returns bool */ public function fitIn($maxWidth, $maxHeight) { diff --git a/lib/private/installer.php b/lib/private/installer.php index 1b974c6e5a5..fe7417990c8 100644 --- a/lib/private/installer.php +++ b/lib/private/installer.php @@ -236,30 +236,6 @@ class OC_Installer{ /** * @brief Update an application - * @param array $data with all information - * - * This function installs an app. All information needed are passed in the - * associative array $data. - * The following keys are required: - * - source: string, can be "path" or "http" - * - * One of the following keys is required: - * - path: path to the file containing the app - * - href: link to the downloadable file containing the app - * - * The following keys are optional: - * - pretend: boolean, if set true the system won't do anything - * - noupgrade: boolean, if true appinfo/upgrade.php won't be loaded - * - * This function works as follows - * -# fetching the file - * -# removing the old files - * -# unzipping new file - * -# including appinfo/upgrade.php - * -# setting the installed version - * - * upgrade.php can determine the current installed version of the app using - * "OC_Appconfig::getValue($appid, 'installed_version')" */ public static function updateApp( $app ) { $ocsid=OC_Appconfig::getValue( $app, 'ocsid'); @@ -270,7 +246,6 @@ class OC_Installer{ /** * @brief Check if an update for the app is available - * @param string $name name of the application * @return string|false false or the version number of the update * * The function will check if an update for a version is available @@ -316,7 +291,7 @@ class OC_Installer{ * @brief Removes an app * @param string $name name of the application to remove * @param $options array with options - * @return boolean + * @return boolean|null * * This function removes an app. $options is an associative array. The * following keys are optional:ja diff --git a/lib/private/l10n.php b/lib/private/l10n.php index 1d8152c5844..1ade18ea427 100644 --- a/lib/private/l10n.php +++ b/lib/private/l10n.php @@ -99,6 +99,9 @@ class OC_L10N implements \OCP\IL10N { $this->lang = $lang; } + /** + * @param string $transFile + */ public function load($transFile) { $this->app = true; include $transFile; diff --git a/lib/private/legacy/appconfig.php b/lib/private/legacy/appconfig.php index 46a8068c3b4..b6c3542a673 100644 --- a/lib/private/legacy/appconfig.php +++ b/lib/private/legacy/appconfig.php @@ -118,6 +118,8 @@ class OC_Appconfig { * * @param app * @param key + * @param string|false $app + * @param string|false $key * @return array */ public static function getValues($app, $key) { diff --git a/lib/private/legacy/preferences.php b/lib/private/legacy/preferences.php index a663db7598b..fcde12796ca 100644 --- a/lib/private/legacy/preferences.php +++ b/lib/private/legacy/preferences.php @@ -41,7 +41,7 @@ class OC_Preferences{ /** * @brief Get all apps of a user * @param string $user user - * @return array with app ids + * @return integer[] with app ids * * This function returns a list of all apps of the user that have at least * one entry in the preferences table. diff --git a/lib/private/migrate.php b/lib/private/migrate.php index b930b719289..3fb3e334ea2 100644 --- a/lib/private/migrate.php +++ b/lib/private/migrate.php @@ -431,6 +431,7 @@ class OC_Migrate{ /** * @brief connects to migration.db, or creates if not found * @param $db optional path to migration.db, defaults to user data dir + * @param string $path * @return bool whether the operation was successful */ static private function connectDB( $path=null ) { @@ -460,7 +461,7 @@ class OC_Migrate{ /** * @brief creates the tables in migration.db from an apps database.xml - * @param $appid string id of the app + * @param string $appid string id of the app * @return bool whether the operation was successful */ static private function createAppTables( $appid ) { diff --git a/lib/private/migration/content.php b/lib/private/migration/content.php index e7b6543171a..43eba89b8d5 100644 --- a/lib/private/migration/content.php +++ b/lib/private/migration/content.php @@ -34,9 +34,9 @@ class OC_Migration_Content{ /** * @brief sets up the - * @param $zip ZipArchive object + * @param ZipArchive $zip ZipArchive object * @param $db a database object (required for exporttype user) - * @return bool + * @return boolean|null */ public function __construct( $zip, $db=null ) { @@ -74,7 +74,7 @@ class OC_Migration_Content{ /** * @brief processes the db query - * @param $query the query to process + * @param string $query the query to process * @return string of processed query */ private function processQuery( $query ) { @@ -130,7 +130,7 @@ class OC_Migration_Content{ /** * @brief saves a sql data set into migration.db - * @param $data a sql data set returned from self::prepare()->query() + * @param OC_DB_StatementWrapper $data a sql data set returned from self::prepare()->query() * @param $options array of copyRows options * @return void */ diff --git a/lib/private/migration/provider.php b/lib/private/migration/provider.php index 234ab3351f3..2829a97a776 100644 --- a/lib/private/migration/provider.php +++ b/lib/private/migration/provider.php @@ -30,7 +30,7 @@ abstract class OC_Migration_Provider{ /** * @brief sets the OC_Migration_Content object to $this->content - * @param $content a OC_Migration_Content object + * @param OC_Migration_Content $content a OC_Migration_Content object */ public function setData( $uid, $content, $info=null ) { $this->content = $content; diff --git a/lib/private/ocs.php b/lib/private/ocs.php index 2305b3eccfe..bbe965ce561 100644 --- a/lib/private/ocs.php +++ b/lib/private/ocs.php @@ -23,9 +23,6 @@ * */ -use Symfony\Component\Routing\Exception\ResourceNotFoundException; -use Symfony\Component\Routing\Exception\MethodNotAllowedException; - /** * Class to handle open collaboration services API requests * @@ -38,7 +35,7 @@ class OC_OCS { * @param string $method HTTP method to read the key from * @param string $key Parameter to read * @param string $type Variable type to format data - * @param mixed $default Default value to return if the key is not found + * @param string $default Default value to return if the key is not found * @return string Data or if the key is not found and no default is set it will exit with a 400 Bad request */ public static function readData($method, $key, $type = 'raw', $default = null) { diff --git a/lib/private/preferences.php b/lib/private/preferences.php index 7ebbf7aa970..d45e6e77089 100644 --- a/lib/private/preferences.php +++ b/lib/private/preferences.php @@ -111,7 +111,7 @@ class Preferences { /** * @brief Get all apps of an user * @param string $user user - * @return array with app ids + * @return integer[] with app ids * * This function returns a list of all apps of the user that have at least * one entry in the preferences table. diff --git a/lib/private/request.php b/lib/private/request.php index a7e7bd0ea1d..0fd20b3cc1f 100755 --- a/lib/private/request.php +++ b/lib/private/request.php @@ -192,7 +192,7 @@ class OC_Request { /** * @brief Check if the requestor understands gzip - * @return boolean true for gzip encoding supported + * @return false|string true for gzip encoding supported */ static public function acceptGZip() { if (!isset($_SERVER['HTTP_ACCEPT_ENCODING'])) { diff --git a/lib/private/share/searchresultsorter.php b/lib/private/share/searchresultsorter.php index fbf77179097..76abbf30846 100644 --- a/lib/private/share/searchresultsorter.php +++ b/lib/private/share/searchresultsorter.php @@ -15,8 +15,8 @@ class SearchResultSorter { private $log; /** - * @param $search the search term as was given by the user - * @param $key the array key containing the value that should be compared + * @param string $search the search term as was given by the user + * @param string $key the array key containing the value that should be compared * against * @param $encoding optional, encoding to use, defaults to UTF-8 * @param $log optional, an \OC\Log instance diff --git a/lib/private/template/base.php b/lib/private/template/base.php index e698d855a91..232a29939cc 100644 --- a/lib/private/template/base.php +++ b/lib/private/template/base.php @@ -30,6 +30,8 @@ class Base { /** * @param string $serverroot * @param string|false $app_dir + * @param string $theme + * @param string $app */ protected function getAppTemplateDirs($theme, $app, $serverroot, $app_dir) { // Check if the app is in the app folder or in the root @@ -47,6 +49,7 @@ class Base { /** * @param string $serverroot + * @param string $theme */ protected function getCoreTemplateDirs($theme, $serverroot) { return array( @@ -119,6 +122,7 @@ class Base { /** * @brief doing the actual work + * @param string $file * @return string content * * Includes the template file, fetches its output diff --git a/lib/private/template/templatefilelocator.php b/lib/private/template/templatefilelocator.php index 05cd752cd4f..4676fceb37d 100644 --- a/lib/private/template/templatefilelocator.php +++ b/lib/private/template/templatefilelocator.php @@ -15,6 +15,7 @@ class TemplateFileLocator { /** * @param string[] $dirs + * @param string $form_factor */ public function __construct( $form_factor, $dirs ) { $this->form_factor = $form_factor; diff --git a/lib/private/user.php b/lib/private/user.php index a8e7967783e..86a01f96258 100644 --- a/lib/private/user.php +++ b/lib/private/user.php @@ -516,6 +516,8 @@ class OC_User { * @returns array with all uids * * Get a list of all users. + * @param integer $limit + * @param integer $offset */ public static function getUsers($search = '', $limit = null, $offset = null) { $users = self::getManager()->search($search, $limit, $offset); diff --git a/lib/private/user/database.php b/lib/private/user/database.php index 094a8f2e2a4..15e6643dfb3 100644 --- a/lib/private/user/database.php +++ b/lib/private/user/database.php @@ -256,7 +256,7 @@ class OC_User_Database extends OC_User_Backend { /** * counts the users in the database * - * @return int | bool + * @return false|string | bool */ public function countUsers() { $query = OC_DB::prepare('SELECT COUNT(*) FROM `*PREFIX*users`'); diff --git a/lib/private/util.php b/lib/private/util.php index af39d983f67..829eedce044 100755 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -218,7 +218,7 @@ class OC_Util { * @brief add a javascript file * * @param string $application - * @param mixed $file filename + * @param string|null $file filename * @return void */ public static function addScript( $application, $file = null ) { @@ -237,7 +237,7 @@ class OC_Util { * @brief add a css file * * @param string $application - * @param mixed $file filename + * @param string|null $file filename * @return void */ public static function addStyle( $application, $file = null ) { @@ -570,6 +570,7 @@ class OC_Util { /** * @brief Check if the app is enabled, redirects to home if not + * @param string $app * @return void */ public static function checkAppEnabled($app) { diff --git a/lib/public/appframework/controller.php b/lib/public/appframework/controller.php index dc8da967871..7c2219bd046 100644 --- a/lib/public/appframework/controller.php +++ b/lib/public/appframework/controller.php @@ -68,7 +68,7 @@ abstract class Controller { * 1. URL parameters * 2. POST parameters * 3. GET parameters - * @param mixed $default If the key is not found, this value will be returned + * @param string $default If the key is not found, this value will be returned * @return mixed the content of the array */ public function params($key, $default=null){ @@ -131,7 +131,7 @@ abstract class Controller { * @param array $params the template parameters in key => value structure * @param string $renderAs user renders a full page, blank only your template * admin an entry in the admin settings - * @param array $headers set additional headers in name/value pairs + * @param string[] $headers set additional headers in name/value pairs * @return \OCP\AppFramework\Http\TemplateResponse containing the page */ public function render($templateName, array $params=array(), diff --git a/lib/public/backgroundjob.php b/lib/public/backgroundjob.php index bcd27c1d198..03b94403b47 100644 --- a/lib/public/backgroundjob.php +++ b/lib/public/backgroundjob.php @@ -59,7 +59,7 @@ class BackgroundJob { * sets the background jobs execution type * * @param string $type execution type - * @return boolean|null + * @return false|null * * This method sets the execution type of the background jobs. Possible types * are "none", "ajax", "webcron", "cron" @@ -115,7 +115,7 @@ class BackgroundJob { * @deprecated * Gets one queued task * @param int $id ID of the task - * @return \OC\BackgroundJob\Job|null array + * @return BackgroundJob\IJob array */ public static function findQueuedTask($id) { $jobList = \OC::$server->getJobList(); diff --git a/lib/public/backgroundjob/ijob.php b/lib/public/backgroundjob/ijob.php index 5231e9537a9..eaf11c4f684 100644 --- a/lib/public/backgroundjob/ijob.php +++ b/lib/public/backgroundjob/ijob.php @@ -14,6 +14,7 @@ interface IJob { * * @param \OCP\BackgroundJob\IJobList $jobList The job list that manages the state of this job * @param \OC\Log $logger + * @return void */ public function execute($jobList, $logger = null); diff --git a/lib/public/backgroundjob/ijoblist.php b/lib/public/backgroundjob/ijoblist.php index 72f3fe863da..c9b546605b8 100644 --- a/lib/public/backgroundjob/ijoblist.php +++ b/lib/public/backgroundjob/ijoblist.php @@ -14,14 +14,17 @@ interface IJobList { * * @param \OCP\BackgroundJob\IJob |string $job * @param mixed $argument The argument to be passed to $job->run() when the job is exectured + * @param string $job + * @return void */ public function add($job, $argument = null); /** * Remove a job from the list * - * @param \OCP\BackgroundJob\IJob|string $job + * @param IJob $job * @param mixed $argument + * @return void */ public function remove($job, $argument = null); @@ -58,6 +61,7 @@ interface IJobList { * set the job that was last ran to the current time * * @param \OCP\BackgroundJob\IJob $job + * @return void */ public function setLastJob($job); @@ -72,6 +76,7 @@ interface IJobList { * set the lastRun of $job to now * * @param \OCP\BackgroundJob\IJob $job + * @return void */ public function setLastRun($job); } diff --git a/lib/public/contacts/imanager.php b/lib/public/contacts/imanager.php index da9bca75525..5b9d64ecc41 100644 --- a/lib/public/contacts/imanager.php +++ b/lib/public/contacts/imanager.php @@ -96,7 +96,7 @@ namespace OCP\Contacts { * This function can be used to delete the contact identified by the given id * * @param object $id the unique identifier to a contact - * @param $address_book_key + * @param $address_book_key * @return bool successful or not */ function delete($id, $address_book_key); @@ -106,7 +106,7 @@ namespace OCP\Contacts { * Otherwise the contact will be updated by replacing the entire data set. * * @param array $properties this array if key-value-pairs defines a contact - * @param $address_book_key string to identify the address book in which the contact shall be created or updated + * @param $address_book_key string to identify the address book in which the contact shall be created or updated * @return array representing the contact just created or updated */ function createOrUpdate($properties, $address_book_key); diff --git a/lib/public/files.php b/lib/public/files.php index 75c52b88fc7..e2d9c81d442 100644 --- a/lib/public/files.php +++ b/lib/public/files.php @@ -37,7 +37,6 @@ namespace OCP; class Files { /** * Recusive deletion of folders - * @param string $path to the folder * @return bool */ static function rmdirr( $dir ) { diff --git a/lib/public/iappconfig.php b/lib/public/iappconfig.php index 3b6484c09d5..1f31898bf2c 100644 --- a/lib/public/iappconfig.php +++ b/lib/public/iappconfig.php @@ -57,6 +57,7 @@ interface IAppConfig { * * @param app * @param key + * @param string $key * @return array */ public function getValues($app, $key); @@ -68,6 +69,7 @@ interface IAppConfig { * @param string $value value * * Sets a value. If the key did not exist before it will be created. + * @return void */ public function setValue($app, $key, $value); diff --git a/lib/public/iconfig.php b/lib/public/iconfig.php index 8944e660780..0ebbd9f5a71 100644 --- a/lib/public/iconfig.php +++ b/lib/public/iconfig.php @@ -47,7 +47,7 @@ interface IConfig { * Looks up a system wide defined value * * @param string $key the key of the value, under which it was saved - * @param mixed $default the default value to be returned if the value isn't set + * @param string $default the default value to be returned if the value isn't set * @return string the saved value */ public function getSystemValue($key, $default = ''); diff --git a/lib/public/itags.php b/lib/public/itags.php index 7965d4152f9..f8ebaa668f1 100644 --- a/lib/public/itags.php +++ b/lib/public/itags.php @@ -147,7 +147,7 @@ interface ITags { * Creates a tag/object relation. * * @param int $objid The id of the object - * @param int|string $tag The id or name of the tag + * @param string $tag The id or name of the tag * @return boolean Returns false on database error. */ public function tagAs($objid, $tag); @@ -156,7 +156,7 @@ interface ITags { * Delete single tag/object relation from the db * * @param int $objid The id of the object - * @param int|string $tag The id or name of the tag + * @param string $tag The id or name of the tag * @return boolean */ public function unTag($objid, $tag); diff --git a/lib/public/share.php b/lib/public/share.php index f6c44a8322b..ebc555dba5f 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -78,6 +78,9 @@ class Share { * @param string Backend class * @param string (optional) Depends on item type * @param array (optional) List of supported file extensions if this item type depends on files + * @param string $itemType + * @param string $class + * @param string $collectionOf * @return boolean true if backend is registered or false if error */ public static function registerBackend($itemType, $class, $collectionOf = null, $supportedFileExtensions = null) { @@ -404,6 +407,7 @@ class Share { * @param mixed Parameters * @param int Number of items to return (optional) Returns all by default * @param bool include collections + * @param string $itemType * @return Return depends on format */ public static function getItemsShared($itemType, $format = self::FORMAT_NONE, $parameters = null, @@ -662,6 +666,8 @@ class Share { * Unshare an item from all users, groups, and remove all links * @param string Item type * @param string Item source + * @param string $itemType + * @param string $itemSource * @return boolean true on success or false on failure */ public static function unshareAll($itemType, $itemSource) { @@ -694,6 +700,8 @@ class Share { * Unshare an item shared with the current user * @param string Item type * @param string Item target + * @param string $itemType + * @param string $itemTarget * @return boolean true on success or false on failure * * Unsharing from self is not allowed for items inside collections @@ -1630,6 +1638,7 @@ class Share { * @param string User that is the owner of shared item * @param string The suggested target originating from a reshare (optional) * @param int The id of the parent group share (optional) + * @param integer $shareType * @return string Item target */ private static function generateTarget($itemType, $itemSource, $shareType, $shareWith, $uidOwner, @@ -1937,6 +1946,8 @@ interface Share_Backend { * Get the source of the item to be stored in the database * @param string Item source * @param string Owner of the item + * @param string $itemSource + * @param string $uidOwner * @return boolean Source * * Return an array if the item is file dependent, the array needs two keys: 'item' and 'file' @@ -1993,6 +2004,8 @@ interface Share_Backend_File_Dependent extends Share_Backend { * Get the file path of the item * @param string Item source * @param string User that is the owner of shared item + * @param string $itemSource + * @param string $uidOwner * @return boolean */ public function getFilePath($itemSource, $uidOwner); diff --git a/tests/lib/api.php b/tests/lib/api.php index 9c4324e63e0..233beebd68a 100644 --- a/tests/lib/api.php +++ b/tests/lib/api.php @@ -9,6 +9,10 @@ class Test_API extends PHPUnit_Framework_TestCase { // Helps build a response variable + + /** + * @param string $message + */ function buildResponse($shipped, $data, $code, $message=null) { return array( 'shipped' => $shipped, @@ -18,6 +22,10 @@ class Test_API extends PHPUnit_Framework_TestCase { } // Validate details of the result + + /** + * @param OC_OCS_Result $result + */ function checkResult($result, $success) { // Check response is of correct type $this->assertInstanceOf('OC_OCS_Result', $result); diff --git a/tests/lib/appframework/http/DispatcherTest.php b/tests/lib/appframework/http/DispatcherTest.php index 6cf0da879ff..9841dcaa1f7 100644 --- a/tests/lib/appframework/http/DispatcherTest.php +++ b/tests/lib/appframework/http/DispatcherTest.php @@ -24,7 +24,6 @@ namespace OC\AppFramework\Http; -use OC\AppFramework\Core\API; use OC\AppFramework\Middleware\MiddlewareDispatcher; use OCP\AppFramework\Http; //require_once(__DIR__ . "/../classloader.php"); @@ -78,6 +77,10 @@ class DispatcherTest extends \PHPUnit_Framework_TestCase { } + /** + * @param string $out + * @param string $httpHeaders + */ private function setMiddlewareExpections($out=null, $httpHeaders=null, $responseHeaders=array(), $ex=false, $catchEx=true) { diff --git a/tests/lib/appframework/http/ResponseTest.php b/tests/lib/appframework/http/ResponseTest.php index 1a38c38c1e7..4f21d77a170 100644 --- a/tests/lib/appframework/http/ResponseTest.php +++ b/tests/lib/appframework/http/ResponseTest.php @@ -25,8 +25,8 @@ namespace OC\AppFramework\Http; -use OCP\AppFramework\Http\Response, - OCP\AppFramework\Http; +use OCP\AppFramework\Http\Response; +use OCP\AppFramework\Http; class ResponseTest extends \PHPUnit_Framework_TestCase { diff --git a/tests/lib/appframework/middleware/MiddlewareDispatcherTest.php b/tests/lib/appframework/middleware/MiddlewareDispatcherTest.php index 95d42e4eb8e..f16b14150c3 100644 --- a/tests/lib/appframework/middleware/MiddlewareDispatcherTest.php +++ b/tests/lib/appframework/middleware/MiddlewareDispatcherTest.php @@ -50,6 +50,9 @@ class TestMiddleware extends Middleware { private $beforeControllerThrowsEx; + /** + * @param boolean $beforeControllerThrowsEx + */ public function __construct($beforeControllerThrowsEx) { self::$beforeControllerCalled = 0; self::$afterControllerCalled = 0; diff --git a/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php b/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php index dae6135dc54..63c48a62829 100644 --- a/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php +++ b/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php @@ -58,6 +58,9 @@ class SecurityMiddlewareTest extends \PHPUnit_Framework_TestCase { } + /** + * @param string $method + */ private function checkNavEntry($method){ $api = $this->getAPI(); @@ -79,6 +82,10 @@ class SecurityMiddlewareTest extends \PHPUnit_Framework_TestCase { } + /** + * @param string $method + * @param string $test + */ private function ajaxExceptionStatus($method, $test, $status) { $api = $this->getAPI(); $api->expects($this->any()) @@ -183,6 +190,10 @@ class SecurityMiddlewareTest extends \PHPUnit_Framework_TestCase { } + /** + * @param string $method + * @param string $expects + */ private function securityCheck($method, $expects, $shouldFail=false){ $api = $this->getAPI(); $api->expects($this->once()) diff --git a/tests/lib/appframework/routing/RoutingTest.php b/tests/lib/appframework/routing/RoutingTest.php index a7aa922db12..d0244cf2511 100644 --- a/tests/lib/appframework/routing/RoutingTest.php +++ b/tests/lib/appframework/routing/RoutingTest.php @@ -78,6 +78,13 @@ class RouteConfigTest extends \PHPUnit_Framework_TestCase $this->assertResource($routes, 'admin_accounts', '/admin/accounts', 'AdminAccountsController', 'adminAccountId'); } + /** + * @param string $name + * @param string $verb + * @param string $url + * @param string $controllerName + * @param string $actionName + */ private function assertSimpleRoute($routes, $name, $verb, $url, $controllerName, $actionName) { // route mocks @@ -100,6 +107,12 @@ class RouteConfigTest extends \PHPUnit_Framework_TestCase $config->register(); } + /** + * @param string $resourceName + * @param string $url + * @param string $controllerName + * @param string $paramName + */ private function assertResource($yaml, $resourceName, $url, $controllerName, $paramName) { // router mock diff --git a/tests/lib/dbschema.php b/tests/lib/dbschema.php index e8a43538004..11e9fcdf4fa 100644 --- a/tests/lib/dbschema.php +++ b/tests/lib/dbschema.php @@ -111,10 +111,16 @@ class Test_DBSchema extends PHPUnit_Framework_TestCase { } } + /** + * @param string $table + */ public function assertTableExist($table) { $this->assertTrue($this->tableExist($table), 'Table ' . $table . ' does not exist'); } + /** + * @param string $table + */ public function assertTableNotExist($table) { $type=OC_Config::getValue( "dbtype", "sqlite" ); if( $type == 'sqlite' || $type == 'sqlite3' ) { diff --git a/tests/lib/errorHandler.php b/tests/lib/errorHandler.php index 68b87deccb6..32396eafbea 100644 --- a/tests/lib/errorHandler.php +++ b/tests/lib/errorHandler.php @@ -56,6 +56,10 @@ class Test_ErrorHandler extends \PHPUnit_Framework_TestCase { * @brief dummy class to access protected methods of \OC\Log\ErrorHandler */ class TestableErrorHandler extends \OC\Log\ErrorHandler { + + /** + * @param string $msg + */ public static function testRemovePassword($msg) { return self::removePassword($msg); } diff --git a/tests/lib/files/cache/homecache.php b/tests/lib/files/cache/homecache.php index 87fd0dba4c6..dbcf6e9caa0 100644 --- a/tests/lib/files/cache/homecache.php +++ b/tests/lib/files/cache/homecache.php @@ -19,6 +19,10 @@ class DummyUser extends \OC\User\User { */ private $uid; + /** + * @param string $uid + * @param string $home + */ public function __construct($uid, $home) { $this->home = $home; $this->uid = $uid; diff --git a/tests/lib/files/etagtest.php b/tests/lib/files/etagtest.php index 6c41413c4df..ce05adb188a 100644 --- a/tests/lib/files/etagtest.php +++ b/tests/lib/files/etagtest.php @@ -68,6 +68,9 @@ class EtagTest extends \PHPUnit_Framework_TestCase { $this->assertEquals($originalEtags, $this->getEtags($files)); } + /** + * @param string[] $files + */ private function getEtags($files) { $etags = array(); foreach ($files as $file) { diff --git a/tests/lib/files/node/integration.php b/tests/lib/files/node/integration.php index 14e1d05853d..319f2f9f5f7 100644 --- a/tests/lib/files/node/integration.php +++ b/tests/lib/files/node/integration.php @@ -9,10 +9,7 @@ namespace Test\Files\Node; use OC\Files\Cache\Cache; -use OC\Files\Mount\Manager; use OC\Files\Node\Root; -use OCP\Files\NotFoundException; -use OCP\Files\NotPermittedException; use OC\Files\Storage\Temporary; use OC\Files\View; use OC\User\User; diff --git a/tests/lib/files/node/root.php b/tests/lib/files/node/root.php index 97eaf7f7162..27f1a937826 100644 --- a/tests/lib/files/node/root.php +++ b/tests/lib/files/node/root.php @@ -8,7 +8,6 @@ namespace Test\Files\Node; -use OC\Files\Cache\Cache; use OCP\Files\NotPermittedException; use OC\Files\Mount\Manager; diff --git a/tests/lib/files/storage/home.php b/tests/lib/files/storage/home.php index 885291e4404..51315a2a556 100644 --- a/tests/lib/files/storage/home.php +++ b/tests/lib/files/storage/home.php @@ -29,6 +29,10 @@ class DummyUser extends User { private $uid; + /** + * @param string $uid + * @param string $home + */ public function __construct($uid, $home) { $this->uid = $uid; $this->home = $home; diff --git a/tests/lib/files/storage/wrapper/quota.php b/tests/lib/files/storage/wrapper/quota.php index 87bafb64d41..e1b880255fb 100644 --- a/tests/lib/files/storage/wrapper/quota.php +++ b/tests/lib/files/storage/wrapper/quota.php @@ -27,6 +27,9 @@ class Quota extends \Test\Files\Storage\Storage { \OC_Helper::rmdirr($this->tmpDir); } + /** + * @param integer $limit + */ protected function getLimitedStorage($limit) { $storage = new \OC\Files\Storage\Local(array('datadir' => $this->tmpDir)); $storage->getScanner()->scan(''); diff --git a/tests/lib/files/stream/quota.php b/tests/lib/files/stream/quota.php index b11f0ac74c0..d5edace544d 100644 --- a/tests/lib/files/stream/quota.php +++ b/tests/lib/files/stream/quota.php @@ -13,6 +13,10 @@ class Quota extends \PHPUnit_Framework_TestCase { \OC\Files\Stream\Quota::clear(); } + /** + * @param string $mode + * @param integer $limit + */ protected function getStream($mode, $limit) { $source = fopen('php://temp', $mode); return \OC\Files\Stream\Quota::wrap($source, $limit); diff --git a/tests/lib/group/backend.php b/tests/lib/group/backend.php index d308232a78b..2c563ae9ac9 100644 --- a/tests/lib/group/backend.php +++ b/tests/lib/group/backend.php @@ -29,7 +29,7 @@ abstract class Test_Group_Backend extends PHPUnit_Framework_TestCase { /** * get a new unique group name * test cases can override this in order to clean up created groups - * @return array + * @return string */ public function getGroupName() { return uniqid('test_'); @@ -38,7 +38,7 @@ abstract class Test_Group_Backend extends PHPUnit_Framework_TestCase { /** * get a new unique user name * test cases can override this in order to clean up created user - * @return array + * @return string */ public function getUserName() { return uniqid('test_'); diff --git a/tests/lib/group/database.php b/tests/lib/group/database.php index 5278c26f4df..3e05c656061 100644 --- a/tests/lib/group/database.php +++ b/tests/lib/group/database.php @@ -26,7 +26,7 @@ class Test_Group_Database extends Test_Group_Backend { /** * get a new unique group name * test cases can override this in order to clean up created groups - * @return array + * @return string */ public function getGroupName() { $name=uniqid('test_'); @@ -37,7 +37,7 @@ class Test_Group_Database extends Test_Group_Backend { /** * get a new unique user name * test cases can override this in order to clean up created user - * @return array + * @return string */ public function getUserName() { return uniqid('test_'); diff --git a/tests/lib/group/group.php b/tests/lib/group/group.php index f1fda3b9288..3982c00e45f 100644 --- a/tests/lib/group/group.php +++ b/tests/lib/group/group.php @@ -13,7 +13,7 @@ use OC\User\User; class Group extends \PHPUnit_Framework_TestCase { /** - * @return \PHPUnit_Framework_MockObject_MockObject | \OC\User\Manager + * @return \OC\User\Manager | \OC\User\Manager */ protected function getUserManager() { $userManager = $this->getMock('\OC\User\Manager'); diff --git a/tests/lib/migrate.php b/tests/lib/migrate.php index 39a9bfc8d5a..d438a7a692e 100644 --- a/tests/lib/migrate.php +++ b/tests/lib/migrate.php @@ -31,6 +31,7 @@ class Test_Migrate extends PHPUnit_Framework_TestCase { * @brief checks for existence of export_info.json and file folder * @param string $exportedUser the user that was exported * @param string $path the path to the .zip export + * @param string $exportedBy */ public function validateUserExport($exportedBy, $exportedUser, $path) { $this->assertTrue(file_exists($path)); diff --git a/tests/lib/ocs/privatedata.php b/tests/lib/ocs/privatedata.php index ea8413734f1..498ab718621 100644 --- a/tests/lib/ocs/privatedata.php +++ b/tests/lib/ocs/privatedata.php @@ -131,6 +131,7 @@ class Test_OC_OCS_Privatedata extends PHPUnit_Framework_TestCase /** * @param \OC_OCS_Result $result + * @param integer $expectedArraySize */ public function assertOcsResult($expectedArraySize, $result) { $this->assertEquals(100, $result->getStatusCode()); diff --git a/tests/lib/share/share.php b/tests/lib/share/share.php index d6acee6c924..a89f100d97a 100644 --- a/tests/lib/share/share.php +++ b/tests/lib/share/share.php @@ -151,6 +151,10 @@ class Test_Share extends PHPUnit_Framework_TestCase { ); } + /** + * @param string $sharer + * @param string $receiver + */ protected function shareUserTestFileWithUser($sharer, $receiver) { OC_User::setUserId($sharer); $this->assertTrue( @@ -558,6 +562,9 @@ class Test_Share extends PHPUnit_Framework_TestCase { ); } + /** + * @param boolean|string $token + */ protected function getShareByValidToken($token) { $row = OCP\Share::getShareByToken($token); $this->assertInternalType( diff --git a/tests/lib/template/resourcelocator.php b/tests/lib/template/resourcelocator.php index d80d222e2c9..619560643fe 100644 --- a/tests/lib/template/resourcelocator.php +++ b/tests/lib/template/resourcelocator.php @@ -7,6 +7,11 @@ */ class Test_ResourceLocator extends PHPUnit_Framework_TestCase { + + /** + * @param string $theme + * @param string $form_factor + */ public function getResourceLocator( $theme, $form_factor, $core_map, $party_map, $appsroots ) { return $this->getMockForAbstractClass('OC\Template\ResourceLocator', array( $theme, $form_factor, $core_map, $party_map, $appsroots ), diff --git a/tests/lib/user.php b/tests/lib/user.php index fdf9e7a08e0..e2c3282a19f 100644 --- a/tests/lib/user.php +++ b/tests/lib/user.php @@ -9,8 +9,6 @@ namespace Test; -use OC\Hooks\PublicEmitter; - class User extends \PHPUnit_Framework_TestCase { /** * @var \OC_User_Backend | \PHPUnit_Framework_MockObject_MockObject $backend diff --git a/tests/testcleanuplistener.php b/tests/testcleanuplistener.php index a969ece6dd5..299a589ef4e 100644 --- a/tests/testcleanuplistener.php +++ b/tests/testcleanuplistener.php @@ -57,6 +57,9 @@ class TestCleanupListener implements PHPUnit_Framework_TestListener { return $this->verbosity === 'detail'; } + /** + * @param string $dir + */ private function unlinkDir($dir) { if ($dh = @opendir($dir)) { while (($file = readdir($dh)) !== false) { -- cgit v1.2.3 From 1a116828cf00b434c5d3f5a3948393a714899df9 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Fri, 14 Mar 2014 10:48:07 +0100 Subject: Added warning for trusted_domains after CLI upgrade If trusted_domains is not set after a CLI upgrade, show a warning in the output. --- core/command/upgrade.php | 26 ++++++++++++++++++++++++++ lib/private/updater.php | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) (limited to 'core/command') diff --git a/core/command/upgrade.php b/core/command/upgrade.php index 128d27aa3db..6e5681b26df 100644 --- a/core/command/upgrade.php +++ b/core/command/upgrade.php @@ -27,6 +27,12 @@ class Upgrade extends Command { ; } + /** + * Execute the upgrade command + * + * @param InputInterface $input input interface + * @param OutputInterface $output output interface + */ protected function execute(InputInterface $input, OutputInterface $output) { global $RUNTIME_NOAPPS; @@ -69,6 +75,9 @@ class Upgrade extends Command { }); $updater->upgrade(); + + $this->postUpgradeCheck($input, $output); + return self::ERROR_SUCCESS; } else if(\OC_Config::getValue('maintenance', false)) { //Possible scenario: ownCloud core is updated but an app failed @@ -84,4 +93,21 @@ class Upgrade extends Command { return self::ERROR_UP_TO_DATE; } } + + /** + * Perform a post upgrade check (specific to the command line tool) + * + * @param InputInterface $input input interface + * @param OutputInterface $output output interface + */ + protected function postUpgradeCheck(InputInterface $input, OutputInterface $output) { + $trustedDomains = \OC_Config::getValue('trusted_domains', array()); + if (empty($trustedDomains)) { + $output->write( + 'The setting "trusted_domains" could not be ' . + 'set automatically by the upgrade script, ' . + 'please set it manually' + ); + } + } } diff --git a/lib/private/updater.php b/lib/private/updater.php index fd2d46a1fac..dd8dc84e804 100644 --- a/lib/private/updater.php +++ b/lib/private/updater.php @@ -108,7 +108,7 @@ class Updater extends BasicEmitter { /* * START CONFIG CHANGES FOR OLDER VERSIONS */ - if (version_compare($currentVersion, '6.90.1', '<')) { + if (!\OC::$CLI && version_compare($currentVersion, '6.90.1', '<')) { // Add the overwriteHost config if it is not existant // This is added to prevent host header poisoning \OC_Config::setValue('trusted_domains', \OC_Config::getValue('trusted_domains', array(\OC_Request::serverHost()))); -- cgit v1.2.3 From 6b9ae27b90ee5649fcab2417ebaf14e87559756e Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Tue, 18 Mar 2014 17:14:38 +0100 Subject: drop file cache migration OC5 -> OC6 --- apps/files/ajax/upgrade.php | 44 ------- apps/files/index.php | 135 ++++++++++----------- apps/files/js/upgrade.js | 28 ----- apps/files/templates/upgrade.php | 4 - core/ajax/update.php | 9 -- core/command/upgrade.php | 9 -- lib/private/files/cache/legacy.php | 139 --------------------- lib/private/files/cache/upgrade.php | 235 ------------------------------------ lib/private/updater.php | 43 ------- 9 files changed, 62 insertions(+), 584 deletions(-) delete mode 100644 apps/files/ajax/upgrade.php delete mode 100644 apps/files/js/upgrade.js delete mode 100644 apps/files/templates/upgrade.php delete mode 100644 lib/private/files/cache/legacy.php delete mode 100644 lib/private/files/cache/upgrade.php (limited to 'core/command') diff --git a/apps/files/ajax/upgrade.php b/apps/files/ajax/upgrade.php deleted file mode 100644 index 7237b02c0b0..00000000000 --- a/apps/files/ajax/upgrade.php +++ /dev/null @@ -1,44 +0,0 @@ -hasItems()) { - OC_Hook::connect('\OC\Files\Cache\Upgrade', 'migrate_path', $listener, 'upgradePath'); - - OC_DB::beginTransaction(); - $upgrade = new \OC\Files\Cache\Upgrade($legacy); - $count = $legacy->getCount(); - $eventSource->send('total', $count); - $upgrade->upgradePath('/' . $user . '/files'); - OC_DB::commit(); -} -\OC\Files\Cache\Upgrade::upgradeDone($user); -$eventSource->send('done', true); -$eventSource->close(); - -class UpgradeListener { - /** - * @var OC_EventSource $eventSource - */ - private $eventSource; - - private $count = 0; - private $lastSend = 0; - - public function __construct($eventSource) { - $this->eventSource = $eventSource; - } - - public function upgradePath($path) { - $this->count++; - if ($this->count > ($this->lastSend + 5)) { - $this->lastSend = $this->count; - $this->eventSource->send('count', $this->count); - } - } -} diff --git a/apps/files/index.php b/apps/files/index.php index ad7a2e210ed..c66cd40fb56 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -62,22 +62,17 @@ if ($isIE8 && isset($_GET['dir'])){ $ajaxLoad = false; $files = array(); $user = OC_User::getUser(); -if (\OC\Files\Cache\Upgrade::needUpgrade($user)) { //dont load anything if we need to upgrade the cache - $needUpgrade = true; -} else { - if ($isIE8){ - // after the redirect above, the URL will have a format - // like "files#?dir=path" which means that no path was given - // (dir is not set). In that specific case, we don't return any - // files because the client will take care of switching the dir - // to the one from the hash, then ajax-load the initial file list - $files = array(); - $ajaxLoad = true; - } - else{ - $files = \OCA\Files\Helper::getFiles($dir); - } - $needUpgrade = false; +if ($isIE8){ + // after the redirect above, the URL will have a format + // like "files#?dir=path" which means that no path was given + // (dir is not set). In that specific case, we don't return any + // files because the client will take care of switching the dir + // to the one from the hash, then ajax-load the initial file list + $files = array(); + $ajaxLoad = true; +} +else{ + $files = \OCA\Files\Helper::getFiles($dir); } $config = \OC::$server->getConfig(); @@ -97,62 +92,56 @@ $breadcrumbNav->assign('baseURL', OCP\Util::linkTo('files', 'index.php') . '?dir $permissions = $dirInfo->getPermissions(); -if ($needUpgrade) { - OCP\Util::addscript('files', 'upgrade'); - $tmpl = new OCP\Template('files', 'upgrade', 'user'); - $tmpl->printPage(); -} else { - // information about storage capacities - $storageInfo=OC_Helper::getStorageInfo($dir); - $freeSpace=$storageInfo['free']; - $uploadLimit=OCP\Util::uploadLimit(); - $maxUploadFilesize=OCP\Util::maxUploadFilesize($dir); - $publicUploadEnabled = $config->getAppValue('core', 'shareapi_allow_public_upload', 'yes'); - // if the encryption app is disabled, than everything is fine (INIT_SUCCESSFUL status code) - $encryptionInitStatus = 2; - if (OC_App::isEnabled('files_encryption')) { - $session = new \OCA\Encryption\Session(new \OC\Files\View('/')); - $encryptionInitStatus = $session->getInitialized(); - } - - $trashEnabled = \OCP\App::isEnabled('files_trashbin'); - $trashEmpty = true; - if ($trashEnabled) { - $trashEmpty = \OCA\Files_Trashbin\Trashbin::isEmpty($user); - } +// information about storage capacities +$storageInfo=OC_Helper::getStorageInfo($dir); +$freeSpace=$storageInfo['free']; +$uploadLimit=OCP\Util::uploadLimit(); +$maxUploadFilesize=OCP\Util::maxUploadFilesize($dir); +$publicUploadEnabled = $config->getAppValue('core', 'shareapi_allow_public_upload', 'yes'); +// if the encryption app is disabled, than everything is fine (INIT_SUCCESSFUL status code) +$encryptionInitStatus = 2; +if (OC_App::isEnabled('files_encryption')) { + $session = new \OCA\Encryption\Session(new \OC\Files\View('/')); + $encryptionInitStatus = $session->getInitialized(); +} - $isCreatable = \OC\Files\Filesystem::isCreatable($dir . '/'); - $fileHeader = (!isset($files) or count($files) > 0); - $emptyContent = ($isCreatable and !$fileHeader) or $ajaxLoad; - - OCP\Util::addscript('files', 'fileactions'); - OCP\Util::addscript('files', 'files'); - OCP\Util::addscript('files', 'keyboardshortcuts'); - $tmpl = new OCP\Template('files', 'index', 'user'); - $tmpl->assign('fileList', $list->fetchPage()); - $tmpl->assign('breadcrumb', $breadcrumbNav->fetchPage()); - $tmpl->assign('dir', $dir); - $tmpl->assign('isCreatable', $isCreatable); - $tmpl->assign('permissions', $permissions); - $tmpl->assign('files', $files); - $tmpl->assign('trash', $trashEnabled); - $tmpl->assign('trashEmpty', $trashEmpty); - $tmpl->assign('uploadMaxFilesize', $maxUploadFilesize); // minimium of freeSpace and uploadLimit - $tmpl->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize)); - $tmpl->assign('freeSpace', $freeSpace); - $tmpl->assign('uploadLimit', $uploadLimit); // PHP upload limit - $tmpl->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true))); - $tmpl->assign('usedSpacePercent', (int)$storageInfo['relative']); - $tmpl->assign('isPublic', false); - $tmpl->assign('publicUploadEnabled', $publicUploadEnabled); - $tmpl->assign("encryptedFiles", \OCP\Util::encryptedFiles()); - $tmpl->assign("mailNotificationEnabled", $config->getAppValue('core', 'shareapi_allow_mail_notification', 'yes')); - $tmpl->assign("allowShareWithLink", $config->getAppValue('core', 'shareapi_allow_links', 'yes')); - $tmpl->assign("encryptionInitStatus", $encryptionInitStatus); - $tmpl->assign('disableSharing', false); - $tmpl->assign('ajaxLoad', $ajaxLoad); - $tmpl->assign('emptyContent', $emptyContent); - $tmpl->assign('fileHeader', $fileHeader); - - $tmpl->printPage(); +$trashEnabled = \OCP\App::isEnabled('files_trashbin'); +$trashEmpty = true; +if ($trashEnabled) { + $trashEmpty = \OCA\Files_Trashbin\Trashbin::isEmpty($user); } + +$isCreatable = \OC\Files\Filesystem::isCreatable($dir . '/'); +$fileHeader = (!isset($files) or count($files) > 0); +$emptyContent = ($isCreatable and !$fileHeader) or $ajaxLoad; + +OCP\Util::addscript('files', 'fileactions'); +OCP\Util::addscript('files', 'files'); +OCP\Util::addscript('files', 'keyboardshortcuts'); +$tmpl = new OCP\Template('files', 'index', 'user'); +$tmpl->assign('fileList', $list->fetchPage()); +$tmpl->assign('breadcrumb', $breadcrumbNav->fetchPage()); +$tmpl->assign('dir', $dir); +$tmpl->assign('isCreatable', $isCreatable); +$tmpl->assign('permissions', $permissions); +$tmpl->assign('files', $files); +$tmpl->assign('trash', $trashEnabled); +$tmpl->assign('trashEmpty', $trashEmpty); +$tmpl->assign('uploadMaxFilesize', $maxUploadFilesize); // minimium of freeSpace and uploadLimit +$tmpl->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize)); +$tmpl->assign('freeSpace', $freeSpace); +$tmpl->assign('uploadLimit', $uploadLimit); // PHP upload limit +$tmpl->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true))); +$tmpl->assign('usedSpacePercent', (int)$storageInfo['relative']); +$tmpl->assign('isPublic', false); +$tmpl->assign('publicUploadEnabled', $publicUploadEnabled); +$tmpl->assign("encryptedFiles", \OCP\Util::encryptedFiles()); +$tmpl->assign("mailNotificationEnabled", $config->getAppValue('core', 'shareapi_allow_mail_notification', 'yes')); +$tmpl->assign("allowShareWithLink", $config->getAppValue('core', 'shareapi_allow_links', 'yes')); +$tmpl->assign("encryptionInitStatus", $encryptionInitStatus); +$tmpl->assign('disableSharing', false); +$tmpl->assign('ajaxLoad', $ajaxLoad); +$tmpl->assign('emptyContent', $emptyContent); +$tmpl->assign('fileHeader', $fileHeader); + +$tmpl->printPage(); diff --git a/apps/files/js/upgrade.js b/apps/files/js/upgrade.js deleted file mode 100644 index 714adf824a1..00000000000 --- a/apps/files/js/upgrade.js +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2014 - * - * This file is licensed under the Affero General Public License version 3 - * or later. - * - * See the COPYING-README file. - * - */ - -/* global OC */ -$(document).ready(function () { - var eventSource, total, bar = $('#progressbar'); - console.log('start'); - bar.progressbar({value: 0}); - eventSource = new OC.EventSource(OC.filePath('files', 'ajax', 'upgrade.php')); - eventSource.listen('total', function (count) { - total = count; - console.log(count + ' files needed to be migrated'); - }); - eventSource.listen('count', function (count) { - bar.progressbar({value: (count / total) * 100}); - console.log(count); - }); - eventSource.listen('done', function () { - document.location.reload(); - }); -}); diff --git a/apps/files/templates/upgrade.php b/apps/files/templates/upgrade.php deleted file mode 100644 index e03f086e47d..00000000000 --- a/apps/files/templates/upgrade.php +++ /dev/null @@ -1,4 +0,0 @@ -
- t('Upgrading filesystem cache...'));?> -
-
diff --git a/core/ajax/update.php b/core/ajax/update.php index d6af84e95b1..2a0cbb2036d 100644 --- a/core/ajax/update.php +++ b/core/ajax/update.php @@ -16,15 +16,6 @@ if (OC::checkUpgrade(false)) { $updater->listen('\OC\Updater', 'dbUpgrade', function () use ($eventSource, $l) { $eventSource->send('success', (string)$l->t('Updated database')); }); - $updater->listen('\OC\Updater', 'filecacheStart', function () use ($eventSource, $l) { - $eventSource->send('success', (string)$l->t('Updating filecache, this may take really long...')); - }); - $updater->listen('\OC\Updater', 'filecacheDone', function () use ($eventSource, $l) { - $eventSource->send('success', (string)$l->t('Updated filecache')); - }); - $updater->listen('\OC\Updater', 'filecacheProgress', function ($out) use ($eventSource, $l) { - $eventSource->send('success', (string)$l->t('... %d%% done ...', array('percent' => $out))); - }); $updater->listen('\OC\Updater', 'failure', function ($message) use ($eventSource) { $eventSource->send('failure', $message); $eventSource->close(); diff --git a/core/command/upgrade.php b/core/command/upgrade.php index 6e5681b26df..cfccfb5d2f0 100644 --- a/core/command/upgrade.php +++ b/core/command/upgrade.php @@ -59,15 +59,6 @@ class Upgrade extends Command { $updater->listen('\OC\Updater', 'dbUpgrade', function () use($output) { $output->writeln('Updated database'); }); - $updater->listen('\OC\Updater', 'filecacheStart', function () use($output) { - $output->writeln('Updating filecache, this may take really long...'); - }); - $updater->listen('\OC\Updater', 'filecacheDone', function () use($output) { - $output->writeln('Updated filecache'); - }); - $updater->listen('\OC\Updater', 'filecacheProgress', function ($out) use($output) { - $output->writeln('... ' . $out . '% done ...'); - }); $updater->listen('\OC\Updater', 'failure', function ($message) use($output) { $output->writeln($message); diff --git a/lib/private/files/cache/legacy.php b/lib/private/files/cache/legacy.php deleted file mode 100644 index 4d5f58741e9..00000000000 --- a/lib/private/files/cache/legacy.php +++ /dev/null @@ -1,139 +0,0 @@ - - * This file is licensed under the Affero General Public License version 3 or - * later. - * See the COPYING-README file. - */ - -namespace OC\Files\Cache; - -/** - * Provide read only support for the old filecache - */ -class Legacy { - private $user; - - private $cacheHasItems = null; - - /** - * @param string $user - */ - public function __construct($user) { - $this->user = $user; - } - - /** - * get the numbers of items in the legacy cache - * - * @return int - */ - function getCount() { - $sql = 'SELECT COUNT(`id`) AS `count` FROM `*PREFIX*fscache` WHERE `user` = ?'; - $result = \OC_DB::executeAudited($sql, array($this->user)); - if ($row = $result->fetchRow()) { - return $row['count']; - } else { - return 0; - } - } - - /** - * check if a legacy cache is present and holds items - * - * @return bool - */ - function hasItems() { - if (!is_null($this->cacheHasItems)) { - return $this->cacheHasItems; - } - try { - $query = \OC_DB::prepare('SELECT `id` FROM `*PREFIX*fscache` WHERE `user` = ?',1); - } catch (\Exception $e) { - $this->cacheHasItems = false; - return false; - } - try { - $result = $query->execute(array($this->user)); - } catch (\Exception $e) { - $this->cacheHasItems = false; - return false; - } - - if ($result === false || property_exists($result, 'error_message_prefix')) { - $this->cacheHasItems = false; - return false; - } - - $this->cacheHasItems = (bool)$result->fetchRow(); - return $this->cacheHasItems; - } - - /** - * get an item from the legacy cache - * - * @param string $path - * @return array - */ - function get($path) { - if (is_numeric($path)) { - $sql = 'SELECT * FROM `*PREFIX*fscache` WHERE `id` = ?'; - } else { - $sql = 'SELECT * FROM `*PREFIX*fscache` WHERE `path` = ?'; - } - $result = \OC_DB::executeAudited($sql, array($path)); - $data = $result->fetchRow(); - $data['etag'] = $this->getEtag($data['path'], $data['user']); - return $data; - } - - /** - * Get the ETag for the given path - * - * @param type $path - * @return string - */ - function getEtag($path, $user = null) { - static $query = null; - - $pathDetails = explode('/', $path, 4); - if((!$user) && !isset($pathDetails[1])) { - //no user!? Too odd, return empty string. - return ''; - } else if(!$user) { - //guess user from path, if no user passed. - $user = $pathDetails[1]; - } - - if(!isset($pathDetails[3]) || is_null($pathDetails[3])) { - $relativePath = ''; - } else { - $relativePath = $pathDetails[3]; - } - - if(is_null($query)){ - $query = \OC_DB::prepare('SELECT `propertyvalue` FROM `*PREFIX*properties` WHERE `userid` = ? AND `propertypath` = ? AND `propertyname` = \'{DAV:}getetag\''); - } - $result = \OC_DB::executeAudited($query,array($user, '/' . $relativePath)); - if ($row = $result->fetchRow()) { - return trim($row['propertyvalue'], '"'); - } else { - return ''; - } - } - - /** - * get all child items of an item from the legacy cache - * - * @param int $id - * @return array - */ - function getChildren($id) { - $result = \OC_DB::executeAudited('SELECT * FROM `*PREFIX*fscache` WHERE `parent` = ?', array($id)); - $data = $result->fetchAll(); - foreach ($data as $i => $item) { - $data[$i]['etag'] = $this->getEtag($item['path'], $item['user']); - } - return $data; - } -} diff --git a/lib/private/files/cache/upgrade.php b/lib/private/files/cache/upgrade.php deleted file mode 100644 index e3a46896cbf..00000000000 --- a/lib/private/files/cache/upgrade.php +++ /dev/null @@ -1,235 +0,0 @@ - - * This file is licensed under the Affero General Public License version 3 or - * later. - * See the COPYING-README file. - */ - -namespace OC\Files\Cache; - -class Upgrade { - /** - * @var Legacy $legacy - */ - private $legacy; - - private $numericIds = array(); - - private $mimeTypeIds = array(); - - /** - * @param Legacy $legacy - */ - public function __construct($legacy) { - $this->legacy = $legacy; - } - - /** - * Preform a upgrade a path and it's childs - * - * @param string $path - * @param bool $mode - */ - function upgradePath($path, $mode = Scanner::SCAN_RECURSIVE) { - if (!$this->legacy->hasItems()) { - return; - } - \OC_Hook::emit('\OC\Files\Cache\Upgrade', 'migrate_path', $path); - if ($row = $this->legacy->get($path)) { - $data = $this->getNewData($row); - if ($data) { - $this->insert($data); - $this->upgradeChilds($data['id'], $mode); - } - } - } - - /** - * upgrade all child elements of an item - * - * @param int $id - * @param bool $mode - */ - function upgradeChilds($id, $mode = Scanner::SCAN_RECURSIVE) { - $children = $this->legacy->getChildren($id); - foreach ($children as $child) { - $childData = $this->getNewData($child); - \OC_Hook::emit('\OC\Files\Cache\Upgrade', 'migrate_path', $child['path']); - if ($childData) { - $this->insert($childData); - if ($mode == Scanner::SCAN_RECURSIVE) { - $this->upgradeChilds($child['id']); - } - } - } - } - - /** - * insert data into the new cache - * - * @param array $data the data for the new cache - */ - function insert($data) { - static $insertQuery = null; - if(is_null($insertQuery)) { - $insertQuery = \OC_DB::prepare('INSERT INTO `*PREFIX*filecache` - ( `fileid`, `storage`, `path`, `path_hash`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`, `etag` ) - VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'); - } - if (!$this->inCache($data['storage'], $data['path_hash'], $data['id'])) { - \OC_DB::executeAudited($insertQuery, array($data['id'], $data['storage'], - $data['path'], $data['path_hash'], $data['parent'], $data['name'], - $data['mimetype'], $data['mimepart'], $data['size'], $data['mtime'], $data['encrypted'], $data['etag'])); - } - } - - /** - * check if an item is already in the new cache - * - * @param string $storage - * @param string $pathHash - * @param string $id - * @return bool - */ - function inCache($storage, $pathHash, $id) { - static $query = null; - if(is_null($query)) { - $query = \OC_DB::prepare('SELECT `fileid` FROM `*PREFIX*filecache` WHERE (`storage` = ? AND `path_hash` = ?) OR `fileid` = ?'); - } - $result = \OC_DB::executeAudited($query, array($storage, $pathHash, $id)); - return (bool)$result->fetchRow(); - } - - /** - * get the new data array from the old one - * - * @param array $data the data from the old cache - * Example data array - * Array - * ( - * [id] => 418 - * [path] => /tina/files/picture.jpg //relative to datadir - * [path_hash] => 66d4547e372888deed80b24fec9b192b - * [parent] => 234 - * [name] => picture.jpg - * [user] => tina - * [size] => 1265283 - * [ctime] => 1363909709 - * [mtime] => 1363909709 - * [mimetype] => image/jpeg - * [mimepart] => image - * [encrypted] => 0 - * [versioned] => 0 - * [writable] => 1 - * ) - * - * @return array - */ - function getNewData($data) { - //Make sure there is a path, otherwise we can do nothing. - if(!isset($data['path'])) { - return false; - } - $newData = $data; - /** - * @var \OC\Files\Storage\Storage $storage - * @var string $internalPath; - */ - list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($data['path']); - if ($storage) { - $newData['etag'] = $data['etag']; - $newData['path_hash'] = md5($internalPath); - $newData['path'] = $internalPath; - $newData['storage'] = $this->getNumericId($storage); - $newData['parent'] = ($internalPath === '') ? -1 : $data['parent']; - $newData['permissions'] = ($data['writable']) ? \OCP\PERMISSION_ALL : \OCP\PERMISSION_READ; - $newData['storage_object'] = $storage; - $newData['mimetype'] = $this->getMimetypeId($newData['mimetype'], $storage); - $newData['mimepart'] = $this->getMimetypeId($newData['mimepart'], $storage); - return $newData; - } else { - \OC_Log::write('core', 'Unable to migrate data from old cache for '.$data['path'].' because the storage was not found', \OC_Log::ERROR); - return false; - } - } - - /** - * get the numeric storage id - * - * @param \OC\Files\Storage\Storage $storage - * @return int - */ - function getNumericId($storage) { - $storageId = $storage->getId(); - if (!isset($this->numericIds[$storageId])) { - $cache = $storage->getCache(); - $this->numericIds[$storageId] = $cache->getNumericStorageId(); - } - return $this->numericIds[$storageId]; - } - - /** - * get the numeric id for a mimetype - * - * @param string $mimetype - * @param \OC\Files\Storage\Storage $storage - * @return int - */ - function getMimetypeId($mimetype, $storage) { - if (!isset($this->mimeTypeIds[$mimetype])) { - $cache = new Cache($storage); - $this->mimeTypeIds[$mimetype] = $cache->getMimetypeId($mimetype); - } - return $this->mimeTypeIds[$mimetype]; - } - - /** - * check if a cache upgrade is required for $user - * - * @param string $user - * @return bool - */ - static function needUpgrade($user) { - $cacheVersion = (int)\OCP\Config::getUserValue($user, 'files', 'cache_version', 4); - if ($cacheVersion < 5) { - $legacy = new \OC\Files\Cache\Legacy($user); - if ($legacy->hasItems()) { - return true; - } - self::upgradeDone($user); - } - - return false; - } - - /** - * mark the filecache as upgrade - * - * @param string $user - */ - static function upgradeDone($user) { - \OCP\Config::setUserValue($user, 'files', 'cache_version', 5); - } - - /** - * Does a "silent" upgrade, i.e. without an Event-Source as triggered - * on User-Login via Ajax. This method is called within the regular - * ownCloud upgrade. - * - * @param string $user a User ID - */ - public static function doSilentUpgrade($user) { - if(!self::needUpgrade($user)) { - return; - } - $legacy = new \OC\Files\Cache\Legacy($user); - if ($legacy->hasItems()) { - \OC_DB::beginTransaction(); - $upgrade = new \OC\Files\Cache\Upgrade($legacy); - $upgrade->upgradePath('/' . $user . '/files'); - \OC_DB::commit(); - } - \OC\Files\Cache\Upgrade::upgradeDone($user); - } -} diff --git a/lib/private/updater.php b/lib/private/updater.php index dd8dc84e804..1354f3fd2f8 100644 --- a/lib/private/updater.php +++ b/lib/private/updater.php @@ -16,9 +16,6 @@ use OC\Hooks\BasicEmitter; * - maintenanceStart() * - maintenanceEnd() * - dbUpgrade() - * - filecacheStart() - * - filecacheProgress(int $percentage) - * - filecacheDone() * - failure(string $message) */ class Updater extends BasicEmitter { @@ -122,9 +119,6 @@ class Updater extends BasicEmitter { \OC_DB::updateDbFromStructure(\OC::$SERVERROOT . '/db_structure.xml'); $this->emit('\OC\Updater', 'dbUpgrade'); - // do a file cache upgrade for users with files - // this can take loooooooooooooooooooooooong - $this->upgradeFileCache(); } catch (\Exception $exception) { $this->emit('\OC\Updater', 'failure', array($exception->getMessage())); } @@ -142,42 +136,5 @@ class Updater extends BasicEmitter { $this->emit('\OC\Updater', 'maintenanceEnd'); } - private function upgradeFileCache() { - try { - $query = \OC_DB::prepare(' - SELECT DISTINCT `user` - FROM `*PREFIX*fscache` - '); - $result = $query->execute(); - } catch (\Exception $e) { - return; - } - $users = $result->fetchAll(); - if (count($users) == 0) { - return; - } - $step = 100 / count($users); - $percentCompleted = 0; - $lastPercentCompletedOutput = 0; - $startInfoShown = false; - foreach ($users as $userRow) { - $user = $userRow['user']; - \OC\Files\Filesystem::initMountPoints($user); - \OC\Files\Cache\Upgrade::doSilentUpgrade($user); - if (!$startInfoShown) { - //We show it only now, because otherwise Info about upgraded apps - //will appear between this and progress info - $this->emit('\OC\Updater', 'filecacheStart'); - $startInfoShown = true; - } - $percentCompleted += $step; - $out = floor($percentCompleted); - if ($out != $lastPercentCompletedOutput) { - $this->emit('\OC\Updater', 'filecacheProgress', array($out)); - $lastPercentCompletedOutput = $out; - } - } - $this->emit('\OC\Updater', 'filecacheDone'); - } } -- cgit v1.2.3