util.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673
  1. <?php
  2. /**
  3. * @author Arthur Schiwon <blizzz@owncloud.com>
  4. * @author Bart Visscher <bartv@thisnet.nl>
  5. * @author Björn Schießle <schiessle@owncloud.com>
  6. * @author Frank Karlitschek <frank@owncloud.org>
  7. * @author Georg Ehrke <georg@owncloud.com>
  8. * @author itheiss <ingo.theiss@i-matrixx.de>
  9. * @author Jens-Christian Fischer <jens-christian.fischer@switch.ch>
  10. * @author Joas Schilling <nickvergessen@owncloud.com>
  11. * @author Lukas Reschke <lukas@owncloud.com>
  12. * @author Michael Gapczynski <GapczynskiM@gmail.com>
  13. * @author Morris Jobke <hey@morrisjobke.de>
  14. * @author Pellaeon Lin <nfsmwlin@gmail.com>
  15. * @author Randolph Carter <RandolphCarter@fantasymail.de>
  16. * @author Robin Appelman <icewind@owncloud.com>
  17. * @author Robin McCorkell <rmccorkell@karoshi.org.uk>
  18. * @author Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
  19. * @author Thomas Müller <thomas.mueller@tmit.eu>
  20. * @author Thomas Tanghus <thomas@tanghus.net>
  21. * @author Victor Dubiniuk <dubiniuk@owncloud.com>
  22. * @author Vincent Petry <pvince81@owncloud.com>
  23. *
  24. * @copyright Copyright (c) 2015, ownCloud, Inc.
  25. * @license AGPL-3.0
  26. *
  27. * This code is free software: you can redistribute it and/or modify
  28. * it under the terms of the GNU Affero General Public License, version 3,
  29. * as published by the Free Software Foundation.
  30. *
  31. * This program is distributed in the hope that it will be useful,
  32. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  33. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  34. * GNU Affero General Public License for more details.
  35. *
  36. * You should have received a copy of the GNU Affero General Public License, version 3,
  37. * along with this program. If not, see <http://www.gnu.org/licenses/>
  38. *
  39. */
  40. /**
  41. * Public interface of ownCloud for apps to use.
  42. * Utility Class.
  43. *
  44. */
  45. // use OCP namespace for all classes that are considered public.
  46. // This means that they should be used by apps instead of the internal ownCloud classes
  47. namespace OCP;
  48. use DateTimeZone;
  49. /**
  50. * This class provides different helper functions to make the life of a developer easier
  51. * @since 4.0.0
  52. */
  53. class Util {
  54. // consts for Logging
  55. const DEBUG=0;
  56. const INFO=1;
  57. const WARN=2;
  58. const ERROR=3;
  59. const FATAL=4;
  60. /**
  61. * get the current installed version of ownCloud
  62. * @return array
  63. * @since 4.0.0
  64. */
  65. public static function getVersion() {
  66. return(\OC_Util::getVersion());
  67. }
  68. /**
  69. * Set current update channel
  70. * @param string $channel
  71. * @since 8.1.0
  72. */
  73. public static function setChannel($channel) {
  74. //Flush timestamp to reload version.php
  75. \OC::$server->getSession()->set('OC_Version_Timestamp', 0);
  76. return \OC::$server->getAppConfig()->setValue('core', 'OC_Channel', $channel);
  77. }
  78. /**
  79. * Get current update channel
  80. * @return string
  81. * @since 8.1.0
  82. */
  83. public static function getChannel() {
  84. return \OC_Util::getChannel();
  85. }
  86. /**
  87. * send an email
  88. * @param string $toaddress
  89. * @param string $toname
  90. * @param string $subject
  91. * @param string $mailtext
  92. * @param string $fromaddress
  93. * @param string $fromname
  94. * @param int $html
  95. * @param string $altbody
  96. * @param string $ccaddress
  97. * @param string $ccname
  98. * @param string $bcc
  99. * @deprecated 8.1.0 Use \OCP\Mail\IMailer instead
  100. * @since 4.0.0
  101. */
  102. public static function sendMail($toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname,
  103. $html = 0, $altbody = '', $ccaddress = '', $ccname = '', $bcc = '') {
  104. $mailer = \OC::$server->getMailer();
  105. $message = $mailer->createMessage();
  106. $message->setTo([$toaddress => $toname]);
  107. $message->setSubject($subject);
  108. $message->setPlainBody($mailtext);
  109. $message->setFrom([$fromaddress => $fromname]);
  110. if($html === 1) {
  111. $message->setHTMLBody($altbody);
  112. }
  113. if($altbody === '') {
  114. $message->setHTMLBody($mailtext);
  115. $message->setPlainBody('');
  116. } else {
  117. $message->setHtmlBody($mailtext);
  118. $message->setPlainBody($altbody);
  119. }
  120. if(!empty($ccaddress)) {
  121. if(!empty($ccname)) {
  122. $message->setCc([$ccaddress => $ccname]);
  123. } else {
  124. $message->setCc([$ccaddress]);
  125. }
  126. }
  127. if(!empty($bcc)) {
  128. $message->setBcc([$bcc]);
  129. }
  130. $mailer->send($message);
  131. }
  132. /**
  133. * write a message in the log
  134. * @param string $app
  135. * @param string $message
  136. * @param int $level
  137. * @since 4.0.0
  138. */
  139. public static function writeLog( $app, $message, $level ) {
  140. // call the internal log class
  141. \OC_LOG::write( $app, $message, $level );
  142. }
  143. /**
  144. * write exception into the log
  145. * @param string $app app name
  146. * @param \Exception $ex exception to log
  147. * @param int $level log level, defaults to \OCP\Util::FATAL
  148. * @since ....0.0 - parameter $level was added in 7.0.0
  149. */
  150. public static function logException( $app, \Exception $ex, $level = \OCP\Util::FATAL ) {
  151. $exception = array(
  152. 'Exception' => get_class($ex),
  153. 'Message' => $ex->getMessage(),
  154. 'Code' => $ex->getCode(),
  155. 'Trace' => $ex->getTraceAsString(),
  156. 'File' => $ex->getFile(),
  157. 'Line' => $ex->getLine(),
  158. );
  159. \OCP\Util::writeLog($app, 'Exception: ' . json_encode($exception), $level);
  160. }
  161. /**
  162. * check if sharing is disabled for the current user
  163. *
  164. * @return boolean
  165. * @since 7.0.0
  166. */
  167. public static function isSharingDisabledForUser() {
  168. return \OC_Util::isSharingDisabledForUser();
  169. }
  170. /**
  171. * get l10n object
  172. * @param string $application
  173. * @param string|null $language
  174. * @return \OC_L10N
  175. * @since 6.0.0 - parameter $language was added in 8.0.0
  176. */
  177. public static function getL10N($application, $language = null) {
  178. return \OC::$server->getL10N($application, $language);
  179. }
  180. /**
  181. * add a css file
  182. * @param string $application
  183. * @param string $file
  184. * @since 4.0.0
  185. */
  186. public static function addStyle( $application, $file = null ) {
  187. \OC_Util::addStyle( $application, $file );
  188. }
  189. /**
  190. * add a javascript file
  191. * @param string $application
  192. * @param string $file
  193. * @since 4.0.0
  194. */
  195. public static function addScript( $application, $file = null ) {
  196. \OC_Util::addScript( $application, $file );
  197. }
  198. /**
  199. * Add a translation JS file
  200. * @param string $application application id
  201. * @param string $languageCode language code, defaults to the current locale
  202. * @since 8.0.0
  203. */
  204. public static function addTranslations($application, $languageCode = null) {
  205. \OC_Util::addTranslations($application, $languageCode);
  206. }
  207. /**
  208. * Add a custom element to the header
  209. * If $text is null then the element will be written as empty element.
  210. * So use "" to get a closing tag.
  211. * @param string $tag tag name of the element
  212. * @param array $attributes array of attributes for the element
  213. * @param string $text the text content for the element
  214. * @since 4.0.0
  215. */
  216. public static function addHeader($tag, $attributes, $text=null) {
  217. \OC_Util::addHeader($tag, $attributes, $text);
  218. }
  219. /**
  220. * formats a timestamp in the "right" way
  221. * @param int $timestamp $timestamp
  222. * @param bool $dateOnly option to omit time from the result
  223. * @param DateTimeZone|string $timeZone where the given timestamp shall be converted to
  224. * @return string timestamp
  225. *
  226. * @deprecated 8.0.0 Use \OC::$server->query('DateTimeFormatter') instead
  227. * @since 4.0.0
  228. */
  229. public static function formatDate($timestamp, $dateOnly=false, $timeZone = null) {
  230. return(\OC_Util::formatDate($timestamp, $dateOnly, $timeZone));
  231. }
  232. /**
  233. * check if some encrypted files are stored
  234. * @return bool
  235. *
  236. * @deprecated 8.1.0 No longer required
  237. * @since 6.0.0
  238. */
  239. public static function encryptedFiles() {
  240. return false;
  241. }
  242. /**
  243. * Creates an absolute url to the given app and file.
  244. * @param string $app app
  245. * @param string $file file
  246. * @param array $args array with param=>value, will be appended to the returned url
  247. * The value of $args will be urlencoded
  248. * @return string the url
  249. * @since 4.0.0 - parameter $args was added in 4.5.0
  250. */
  251. public static function linkToAbsolute( $app, $file, $args = array() ) {
  252. return(\OC_Helper::linkToAbsolute( $app, $file, $args ));
  253. }
  254. /**
  255. * Creates an absolute url for remote use.
  256. * @param string $service id
  257. * @return string the url
  258. * @since 4.0.0
  259. */
  260. public static function linkToRemote( $service ) {
  261. return(\OC_Helper::linkToRemote( $service ));
  262. }
  263. /**
  264. * Creates an absolute url for public use
  265. * @param string $service id
  266. * @return string the url
  267. * @since 4.5.0
  268. */
  269. public static function linkToPublic($service) {
  270. return \OC_Helper::linkToPublic($service);
  271. }
  272. /**
  273. * Creates an url using a defined route
  274. * @param string $route
  275. * @param array $parameters
  276. * @internal param array $args with param=>value, will be appended to the returned url
  277. * @return string the url
  278. * @deprecated 8.1.0 Use \OC::$server->getURLGenerator()->linkToRoute($route, $parameters)
  279. * @since 5.0.0
  280. */
  281. public static function linkToRoute( $route, $parameters = array() ) {
  282. return \OC_Helper::linkToRoute($route, $parameters);
  283. }
  284. /**
  285. * Creates an url to the given app and file
  286. * @param string $app app
  287. * @param string $file file
  288. * @param array $args array with param=>value, will be appended to the returned url
  289. * The value of $args will be urlencoded
  290. * @return string the url
  291. * @deprecated 8.1.0 Use \OC::$server->getURLGenerator()->linkTo($app, $file, $args)
  292. * @since 4.0.0 - parameter $args was added in 4.5.0
  293. */
  294. public static function linkTo( $app, $file, $args = array() ) {
  295. return(\OC_Helper::linkTo( $app, $file, $args ));
  296. }
  297. /**
  298. * Returns the server host, even if the website uses one or more reverse proxy
  299. * @return string the server host
  300. * @deprecated 8.1.0 Use \OCP\IRequest::getServerHost
  301. * @since 4.0.0
  302. */
  303. public static function getServerHost() {
  304. return \OC::$server->getRequest()->getServerHost();
  305. }
  306. /**
  307. * Returns the server host name without an eventual port number
  308. * @return string the server hostname
  309. * @since 5.0.0
  310. */
  311. public static function getServerHostName() {
  312. $host_name = self::getServerHost();
  313. // strip away port number (if existing)
  314. $colon_pos = strpos($host_name, ':');
  315. if ($colon_pos != FALSE) {
  316. $host_name = substr($host_name, 0, $colon_pos);
  317. }
  318. return $host_name;
  319. }
  320. /**
  321. * Returns the default email address
  322. * @param string $user_part the user part of the address
  323. * @return string the default email address
  324. *
  325. * Assembles a default email address (using the server hostname
  326. * and the given user part, and returns it
  327. * Example: when given lostpassword-noreply as $user_part param,
  328. * and is currently accessed via http(s)://example.com/,
  329. * it would return 'lostpassword-noreply@example.com'
  330. *
  331. * If the configuration value 'mail_from_address' is set in
  332. * config.php, this value will override the $user_part that
  333. * is passed to this function
  334. * @since 5.0.0
  335. */
  336. public static function getDefaultEmailAddress($user_part) {
  337. $user_part = \OC_Config::getValue('mail_from_address', $user_part);
  338. $host_name = self::getServerHostName();
  339. $host_name = \OC_Config::getValue('mail_domain', $host_name);
  340. $defaultEmailAddress = $user_part.'@'.$host_name;
  341. $mailer = \OC::$server->getMailer();
  342. if ($mailer->validateMailAddress($defaultEmailAddress)) {
  343. return $defaultEmailAddress;
  344. }
  345. // in case we cannot build a valid email address from the hostname let's fallback to 'localhost.localdomain'
  346. return $user_part.'@localhost.localdomain';
  347. }
  348. /**
  349. * Returns the server protocol. It respects reverse proxy servers and load balancers
  350. * @return string the server protocol
  351. * @deprecated 8.1.0 Use \OCP\IRequest::getServerProtocol
  352. * @since 4.5.0
  353. */
  354. public static function getServerProtocol() {
  355. return \OC::$server->getRequest()->getServerProtocol();
  356. }
  357. /**
  358. * Returns the request uri, even if the website uses one or more reverse proxies
  359. * @return string the request uri
  360. * @deprecated 8.1.0 Use \OCP\IRequest::getRequestUri
  361. * @since 5.0.0
  362. */
  363. public static function getRequestUri() {
  364. return \OC::$server->getRequest()->getRequestUri();
  365. }
  366. /**
  367. * Returns the script name, even if the website uses one or more reverse proxies
  368. * @return string the script name
  369. * @deprecated 8.1.0 Use \OCP\IRequest::getScriptName
  370. * @since 5.0.0
  371. */
  372. public static function getScriptName() {
  373. return \OC::$server->getRequest()->getScriptName();
  374. }
  375. /**
  376. * Creates path to an image
  377. * @param string $app app
  378. * @param string $image image name
  379. * @return string the url
  380. * @deprecated 8.1.0 Use \OC::$server->getURLGenerator()->imagePath($app, $image)
  381. * @since 4.0.0
  382. */
  383. public static function imagePath( $app, $image ) {
  384. return \OC::$server->getURLGenerator()->imagePath($app, $image);
  385. }
  386. /**
  387. * Make a human file size (2048 to 2 kB)
  388. * @param int $bytes file size in bytes
  389. * @return string a human readable file size
  390. * @since 4.0.0
  391. */
  392. public static function humanFileSize( $bytes ) {
  393. return(\OC_Helper::humanFileSize( $bytes ));
  394. }
  395. /**
  396. * Make a computer file size (2 kB to 2048)
  397. * @param string $str file size in a fancy format
  398. * @return int a file size in bytes
  399. *
  400. * Inspired by: http://www.php.net/manual/en/function.filesize.php#92418
  401. * @since 4.0.0
  402. */
  403. public static function computerFileSize( $str ) {
  404. return(\OC_Helper::computerFileSize( $str ));
  405. }
  406. /**
  407. * connects a function to a hook
  408. *
  409. * @param string $signalClass class name of emitter
  410. * @param string $signalName name of signal
  411. * @param string|object $slotClass class name of slot
  412. * @param string $slotName name of slot
  413. * @return bool
  414. *
  415. * This function makes it very easy to connect to use hooks.
  416. *
  417. * TODO: write example
  418. * @since 4.0.0
  419. */
  420. static public function connectHook($signalClass, $signalName, $slotClass, $slotName ) {
  421. return(\OC_Hook::connect($signalClass, $signalName, $slotClass, $slotName ));
  422. }
  423. /**
  424. * Emits a signal. To get data from the slot use references!
  425. * @param string $signalclass class name of emitter
  426. * @param string $signalname name of signal
  427. * @param array $params default: array() array with additional data
  428. * @return bool true if slots exists or false if not
  429. *
  430. * TODO: write example
  431. * @since 4.0.0
  432. */
  433. static public function emitHook( $signalclass, $signalname, $params = array()) {
  434. return(\OC_Hook::emit( $signalclass, $signalname, $params ));
  435. }
  436. /**
  437. * Register an get/post call. This is important to prevent CSRF attacks
  438. * TODO: write example
  439. * @since 4.5.0
  440. */
  441. public static function callRegister() {
  442. return(\OC_Util::callRegister());
  443. }
  444. /**
  445. * Check an ajax get/post call if the request token is valid. exit if not.
  446. * Todo: Write howto
  447. * @since 4.5.0
  448. */
  449. public static function callCheck() {
  450. \OC_Util::callCheck();
  451. }
  452. /**
  453. * Used to sanitize HTML
  454. *
  455. * This function is used to sanitize HTML and should be applied on any
  456. * string or array of strings before displaying it on a web page.
  457. *
  458. * @param string|array $value
  459. * @return string|array an array of sanitized strings or a single sinitized string, depends on the input parameter.
  460. * @since 4.5.0
  461. */
  462. public static function sanitizeHTML( $value ) {
  463. return(\OC_Util::sanitizeHTML($value));
  464. }
  465. /**
  466. * Public function to encode url parameters
  467. *
  468. * This function is used to encode path to file before output.
  469. * Encoding is done according to RFC 3986 with one exception:
  470. * Character '/' is preserved as is.
  471. *
  472. * @param string $component part of URI to encode
  473. * @return string
  474. * @since 6.0.0
  475. */
  476. public static function encodePath($component) {
  477. return(\OC_Util::encodePath($component));
  478. }
  479. /**
  480. * Returns an array with all keys from input lowercased or uppercased. Numbered indices are left as is.
  481. *
  482. * @param array $input The array to work on
  483. * @param int $case Either MB_CASE_UPPER or MB_CASE_LOWER (default)
  484. * @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8
  485. * @return array
  486. * @since 4.5.0
  487. */
  488. public static function mb_array_change_key_case($input, $case = MB_CASE_LOWER, $encoding = 'UTF-8') {
  489. return(\OC_Helper::mb_array_change_key_case($input, $case, $encoding));
  490. }
  491. /**
  492. * replaces a copy of string delimited by the start and (optionally) length parameters with the string given in replacement.
  493. *
  494. * @param string $string The input string. Opposite to the PHP build-in function does not accept an array.
  495. * @param string $replacement The replacement string.
  496. * @param int $start If start is positive, the replacing will begin at the start'th offset into string. If start is negative, the replacing will begin at the start'th character from the end of string.
  497. * @param int $length Length of the part to be replaced
  498. * @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8
  499. * @return string
  500. * @since 4.5.0
  501. */
  502. public static function mb_substr_replace($string, $replacement, $start, $length = null, $encoding = 'UTF-8') {
  503. return(\OC_Helper::mb_substr_replace($string, $replacement, $start, $length, $encoding));
  504. }
  505. /**
  506. * Replace all occurrences of the search string with the replacement string
  507. *
  508. * @param string $search The value being searched for, otherwise known as the needle. String.
  509. * @param string $replace The replacement string.
  510. * @param string $subject The string or array being searched and replaced on, otherwise known as the haystack.
  511. * @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8
  512. * @param int $count If passed, this will be set to the number of replacements performed.
  513. * @return string
  514. * @since 4.5.0
  515. */
  516. public static function mb_str_replace($search, $replace, $subject, $encoding = 'UTF-8', &$count = null) {
  517. return(\OC_Helper::mb_str_replace($search, $replace, $subject, $encoding, $count));
  518. }
  519. /**
  520. * performs a search in a nested array
  521. *
  522. * @param array $haystack the array to be searched
  523. * @param string $needle the search string
  524. * @param int $index optional, only search this key name
  525. * @return mixed the key of the matching field, otherwise false
  526. * @since 4.5.0
  527. */
  528. public static function recursiveArraySearch($haystack, $needle, $index = null) {
  529. return(\OC_Helper::recursiveArraySearch($haystack, $needle, $index));
  530. }
  531. /**
  532. * calculates the maximum upload size respecting system settings, free space and user quota
  533. *
  534. * @param string $dir the current folder where the user currently operates
  535. * @param int $free the number of bytes free on the storage holding $dir, if not set this will be received from the storage directly
  536. * @return int number of bytes representing
  537. * @since 5.0.0
  538. */
  539. public static function maxUploadFilesize($dir, $free = null) {
  540. return \OC_Helper::maxUploadFilesize($dir, $free);
  541. }
  542. /**
  543. * Calculate free space left within user quota
  544. * @param string $dir the current folder where the user currently operates
  545. * @return int number of bytes representing
  546. * @since 7.0.0
  547. */
  548. public static function freeSpace($dir) {
  549. return \OC_Helper::freeSpace($dir);
  550. }
  551. /**
  552. * Calculate PHP upload limit
  553. *
  554. * @return int number of bytes representing
  555. * @since 7.0.0
  556. */
  557. public static function uploadLimit() {
  558. return \OC_Helper::uploadLimit();
  559. }
  560. /**
  561. * Returns whether the given file name is valid
  562. * @param string $file file name to check
  563. * @return bool true if the file name is valid, false otherwise
  564. * @deprecated 8.1.0 use \OC\Files\View::verifyPath()
  565. * @since 7.0.0
  566. */
  567. public static function isValidFileName($file) {
  568. return \OC_Util::isValidFileName($file);
  569. }
  570. /**
  571. * Generates a cryptographic secure pseudo-random string
  572. * @param int $length of the random string
  573. * @return string
  574. * @deprecated 8.0.0 Use \OC::$server->getSecureRandom()->getMediumStrengthGenerator()->generate($length); instead
  575. * @since 7.0.0
  576. */
  577. public static function generateRandomBytes($length = 30) {
  578. return \OC_Util::generateRandomBytes($length);
  579. }
  580. /**
  581. * Compare two strings to provide a natural sort
  582. * @param string $a first string to compare
  583. * @param string $b second string to compare
  584. * @return -1 if $b comes before $a, 1 if $a comes before $b
  585. * or 0 if the strings are identical
  586. * @since 7.0.0
  587. */
  588. public static function naturalSortCompare($a, $b) {
  589. return \OC\NaturalSort::getInstance()->compare($a, $b);
  590. }
  591. /**
  592. * check if a password is required for each public link
  593. * @return boolean
  594. * @since 7.0.0
  595. */
  596. public static function isPublicLinkPasswordRequired() {
  597. return \OC_Util::isPublicLinkPasswordRequired();
  598. }
  599. /**
  600. * check if share API enforces a default expire date
  601. * @return boolean
  602. * @since 8.0.0
  603. */
  604. public static function isDefaultExpireDateEnforced() {
  605. return \OC_Util::isDefaultExpireDateEnforced();
  606. }
  607. /**
  608. * Checks whether the current version needs upgrade.
  609. *
  610. * @return bool true if upgrade is needed, false otherwise
  611. * @since 7.0.0
  612. */
  613. public static function needUpgrade() {
  614. return \OC_Util::needUpgrade(\OC::$server->getConfig());
  615. }
  616. }