1
0

Setup.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Administrator "Administrator@WINDOWS-2012"
  6. * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
  7. * @author Bart Visscher <bartv@thisnet.nl>
  8. * @author Bernhard Posselt <dev@bernhard-posselt.com>
  9. * @author Bjoern Schiessle <bjoern@schiessle.org>
  10. * @author Brice Maron <brice@bmaron.net>
  11. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  12. * @author Dan Callahan <dan.callahan@gmail.com>
  13. * @author Daniel Kesselberg <mail@danielkesselberg.de>
  14. * @author François Kubler <francois@kubler.org>
  15. * @author Frank Isemann <frank@isemann.name>
  16. * @author Jakob Sack <mail@jakobsack.de>
  17. * @author Joas Schilling <coding@schilljs.com>
  18. * @author Julius Härtl <jus@bitgrid.net>
  19. * @author KB7777 <k.burkowski@gmail.com>
  20. * @author Kevin Lanni <therealklanni@gmail.com>
  21. * @author Lukas Reschke <lukas@statuscode.ch>
  22. * @author MichaIng <28480705+MichaIng@users.noreply.github.com>
  23. * @author MichaIng <micha@dietpi.com>
  24. * @author Morris Jobke <hey@morrisjobke.de>
  25. * @author Robin Appelman <robin@icewind.nl>
  26. * @author Roeland Jago Douma <roeland@famdouma.nl>
  27. * @author Sean Comeau <sean@ftlnetworks.ca>
  28. * @author Serge Martin <edb@sigluy.net>
  29. * @author Simounet <contact@simounet.net>
  30. * @author Thomas Müller <thomas.mueller@tmit.eu>
  31. * @author Valdnet <47037905+Valdnet@users.noreply.github.com>
  32. * @author Vincent Petry <vincent@nextcloud.com>
  33. *
  34. * @license AGPL-3.0
  35. *
  36. * This code is free software: you can redistribute it and/or modify
  37. * it under the terms of the GNU Affero General Public License, version 3,
  38. * as published by the Free Software Foundation.
  39. *
  40. * This program is distributed in the hope that it will be useful,
  41. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  42. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  43. * GNU Affero General Public License for more details.
  44. *
  45. * You should have received a copy of the GNU Affero General Public License, version 3,
  46. * along with this program. If not, see <http://www.gnu.org/licenses/>
  47. *
  48. */
  49. namespace OC;
  50. use bantu\IniGetWrapper\IniGetWrapper;
  51. use Exception;
  52. use InvalidArgumentException;
  53. use OC\App\AppStore\Bundles\BundleFetcher;
  54. use OC\Authentication\Token\DefaultTokenCleanupJob;
  55. use OC\Authentication\Token\DefaultTokenProvider;
  56. use OC\Log\Rotate;
  57. use OC\Preview\BackgroundCleanupJob;
  58. use OCP\AppFramework\Utility\ITimeFactory;
  59. use OCP\Defaults;
  60. use OCP\IGroup;
  61. use OCP\IL10N;
  62. use OCP\Security\ISecureRandom;
  63. use Psr\Log\LoggerInterface;
  64. class Setup {
  65. /** @var SystemConfig */
  66. protected $config;
  67. /** @var IniGetWrapper */
  68. protected $iniWrapper;
  69. /** @var IL10N */
  70. protected $l10n;
  71. /** @var Defaults */
  72. protected $defaults;
  73. /** @var LoggerInterface */
  74. protected $logger;
  75. /** @var ISecureRandom */
  76. protected $random;
  77. /** @var Installer */
  78. protected $installer;
  79. public function __construct(
  80. SystemConfig $config,
  81. IniGetWrapper $iniWrapper,
  82. IL10N $l10n,
  83. Defaults $defaults,
  84. LoggerInterface $logger,
  85. ISecureRandom $random,
  86. Installer $installer
  87. ) {
  88. $this->config = $config;
  89. $this->iniWrapper = $iniWrapper;
  90. $this->l10n = $l10n;
  91. $this->defaults = $defaults;
  92. $this->logger = $logger;
  93. $this->random = $random;
  94. $this->installer = $installer;
  95. }
  96. protected static $dbSetupClasses = [
  97. 'mysql' => \OC\Setup\MySQL::class,
  98. 'pgsql' => \OC\Setup\PostgreSQL::class,
  99. 'oci' => \OC\Setup\OCI::class,
  100. 'sqlite' => \OC\Setup\Sqlite::class,
  101. 'sqlite3' => \OC\Setup\Sqlite::class,
  102. ];
  103. /**
  104. * Wrapper around the "class_exists" PHP function to be able to mock it
  105. *
  106. * @param string $name
  107. * @return bool
  108. */
  109. protected function class_exists($name) {
  110. return class_exists($name);
  111. }
  112. /**
  113. * Wrapper around the "is_callable" PHP function to be able to mock it
  114. *
  115. * @param string $name
  116. * @return bool
  117. */
  118. protected function is_callable($name) {
  119. return is_callable($name);
  120. }
  121. /**
  122. * Wrapper around \PDO::getAvailableDrivers
  123. *
  124. * @return array
  125. */
  126. protected function getAvailableDbDriversForPdo() {
  127. return \PDO::getAvailableDrivers();
  128. }
  129. /**
  130. * Get the available and supported databases of this instance
  131. *
  132. * @param bool $allowAllDatabases
  133. * @return array
  134. * @throws Exception
  135. */
  136. public function getSupportedDatabases($allowAllDatabases = false) {
  137. $availableDatabases = [
  138. 'sqlite' => [
  139. 'type' => 'pdo',
  140. 'call' => 'sqlite',
  141. 'name' => 'SQLite',
  142. ],
  143. 'mysql' => [
  144. 'type' => 'pdo',
  145. 'call' => 'mysql',
  146. 'name' => 'MySQL/MariaDB',
  147. ],
  148. 'pgsql' => [
  149. 'type' => 'pdo',
  150. 'call' => 'pgsql',
  151. 'name' => 'PostgreSQL',
  152. ],
  153. 'oci' => [
  154. 'type' => 'function',
  155. 'call' => 'oci_connect',
  156. 'name' => 'Oracle',
  157. ],
  158. ];
  159. if ($allowAllDatabases) {
  160. $configuredDatabases = array_keys($availableDatabases);
  161. } else {
  162. $configuredDatabases = $this->config->getValue('supportedDatabases',
  163. ['sqlite', 'mysql', 'pgsql']);
  164. }
  165. if (!is_array($configuredDatabases)) {
  166. throw new Exception('Supported databases are not properly configured.');
  167. }
  168. $supportedDatabases = [];
  169. foreach ($configuredDatabases as $database) {
  170. if (array_key_exists($database, $availableDatabases)) {
  171. $working = false;
  172. $type = $availableDatabases[$database]['type'];
  173. $call = $availableDatabases[$database]['call'];
  174. if ($type === 'function') {
  175. $working = $this->is_callable($call);
  176. } elseif ($type === 'pdo') {
  177. $working = in_array($call, $this->getAvailableDbDriversForPdo(), true);
  178. }
  179. if ($working) {
  180. $supportedDatabases[$database] = $availableDatabases[$database]['name'];
  181. }
  182. }
  183. }
  184. return $supportedDatabases;
  185. }
  186. /**
  187. * Gathers system information like database type and does
  188. * a few system checks.
  189. *
  190. * @return array of system info, including an "errors" value
  191. * in case of errors/warnings
  192. */
  193. public function getSystemInfo($allowAllDatabases = false) {
  194. $databases = $this->getSupportedDatabases($allowAllDatabases);
  195. $dataDir = $this->config->getValue('datadirectory', \OC::$SERVERROOT . '/data');
  196. $errors = [];
  197. // Create data directory to test whether the .htaccess works
  198. // Notice that this is not necessarily the same data directory as the one
  199. // that will effectively be used.
  200. if (!file_exists($dataDir)) {
  201. @mkdir($dataDir);
  202. }
  203. $htAccessWorking = true;
  204. if (is_dir($dataDir) && is_writable($dataDir)) {
  205. // Protect data directory here, so we can test if the protection is working
  206. self::protectDataDirectory();
  207. try {
  208. $util = new \OC_Util();
  209. $htAccessWorking = $util->isHtaccessWorking(\OC::$server->getConfig());
  210. } catch (\OC\HintException $e) {
  211. $errors[] = [
  212. 'error' => $e->getMessage(),
  213. 'exception' => $e,
  214. 'hint' => $e->getHint(),
  215. ];
  216. $htAccessWorking = false;
  217. }
  218. }
  219. if (\OC_Util::runningOnMac()) {
  220. $errors[] = [
  221. 'error' => $this->l10n->t(
  222. 'Mac OS X is not supported and %s will not work properly on this platform. ' .
  223. 'Use it at your own risk! ',
  224. [$this->defaults->getProductName()]
  225. ),
  226. 'hint' => $this->l10n->t('For the best results, please consider using a GNU/Linux server instead.'),
  227. ];
  228. }
  229. if ($this->iniWrapper->getString('open_basedir') !== '' && PHP_INT_SIZE === 4) {
  230. $errors[] = [
  231. 'error' => $this->l10n->t(
  232. 'It seems that this %s instance is running on a 32-bit PHP environment and the open_basedir has been configured in php.ini. ' .
  233. 'This will lead to problems with files over 4 GB and is highly discouraged.',
  234. [$this->defaults->getProductName()]
  235. ),
  236. 'hint' => $this->l10n->t('Please remove the open_basedir setting within your php.ini or switch to 64-bit PHP.'),
  237. ];
  238. }
  239. return [
  240. 'hasSQLite' => isset($databases['sqlite']),
  241. 'hasMySQL' => isset($databases['mysql']),
  242. 'hasPostgreSQL' => isset($databases['pgsql']),
  243. 'hasOracle' => isset($databases['oci']),
  244. 'databases' => $databases,
  245. 'directory' => $dataDir,
  246. 'htaccessWorking' => $htAccessWorking,
  247. 'errors' => $errors,
  248. ];
  249. }
  250. /**
  251. * @param $options
  252. * @return array
  253. */
  254. public function install($options) {
  255. $l = $this->l10n;
  256. $error = [];
  257. $dbType = $options['dbtype'];
  258. if (empty($options['adminlogin'])) {
  259. $error[] = $l->t('Set an admin username.');
  260. }
  261. if (empty($options['adminpass'])) {
  262. $error[] = $l->t('Set an admin password.');
  263. }
  264. if (empty($options['directory'])) {
  265. $options['directory'] = \OC::$SERVERROOT . "/data";
  266. }
  267. if (!isset(self::$dbSetupClasses[$dbType])) {
  268. $dbType = 'sqlite';
  269. }
  270. $username = htmlspecialchars_decode($options['adminlogin']);
  271. $password = htmlspecialchars_decode($options['adminpass']);
  272. $dataDir = htmlspecialchars_decode($options['directory']);
  273. $class = self::$dbSetupClasses[$dbType];
  274. /** @var \OC\Setup\AbstractDatabase $dbSetup */
  275. $dbSetup = new $class($l, $this->config, $this->logger, $this->random);
  276. $error = array_merge($error, $dbSetup->validate($options));
  277. // validate the data directory
  278. if ((!is_dir($dataDir) && !mkdir($dataDir)) || !is_writable($dataDir)) {
  279. $error[] = $l->t("Cannot create or write into the data directory %s", [$dataDir]);
  280. }
  281. if (!empty($error)) {
  282. return $error;
  283. }
  284. $request = \OC::$server->getRequest();
  285. //no errors, good
  286. if (isset($options['trusted_domains'])
  287. && is_array($options['trusted_domains'])) {
  288. $trustedDomains = $options['trusted_domains'];
  289. } else {
  290. $trustedDomains = [$request->getInsecureServerHost()];
  291. }
  292. //use sqlite3 when available, otherwise sqlite2 will be used.
  293. if ($dbType === 'sqlite' && class_exists('SQLite3')) {
  294. $dbType = 'sqlite3';
  295. }
  296. //generate a random salt that is used to salt the local user passwords
  297. $salt = $this->random->generate(30);
  298. // generate a secret
  299. $secret = $this->random->generate(48);
  300. //write the config file
  301. $newConfigValues = [
  302. 'passwordsalt' => $salt,
  303. 'secret' => $secret,
  304. 'trusted_domains' => $trustedDomains,
  305. 'datadirectory' => $dataDir,
  306. 'dbtype' => $dbType,
  307. 'version' => implode('.', \OCP\Util::getVersion()),
  308. ];
  309. if ($this->config->getValue('overwrite.cli.url', null) === null) {
  310. $newConfigValues['overwrite.cli.url'] = $request->getServerProtocol() . '://' . $request->getInsecureServerHost() . \OC::$WEBROOT;
  311. }
  312. $this->config->setValues($newConfigValues);
  313. $dbSetup->initialize($options);
  314. try {
  315. $dbSetup->setupDatabase($username);
  316. } catch (\OC\DatabaseSetupException $e) {
  317. $error[] = [
  318. 'error' => $e->getMessage(),
  319. 'exception' => $e,
  320. 'hint' => $e->getHint(),
  321. ];
  322. return $error;
  323. } catch (Exception $e) {
  324. $error[] = [
  325. 'error' => 'Error while trying to create admin user: ' . $e->getMessage(),
  326. 'exception' => $e,
  327. 'hint' => '',
  328. ];
  329. return $error;
  330. }
  331. try {
  332. // apply necessary migrations
  333. $dbSetup->runMigrations();
  334. } catch (Exception $e) {
  335. $error[] = [
  336. 'error' => 'Error while trying to initialise the database: ' . $e->getMessage(),
  337. 'exception' => $e,
  338. 'hint' => '',
  339. ];
  340. return $error;
  341. }
  342. //create the user and group
  343. $user = null;
  344. try {
  345. $user = \OC::$server->getUserManager()->createUser($username, $password);
  346. if (!$user) {
  347. $error[] = "User <$username> could not be created.";
  348. }
  349. } catch (Exception $exception) {
  350. $error[] = $exception->getMessage();
  351. }
  352. if (empty($error)) {
  353. $config = \OC::$server->getConfig();
  354. $config->setAppValue('core', 'installedat', microtime(true));
  355. $config->setAppValue('core', 'lastupdatedat', microtime(true));
  356. $config->setAppValue('core', 'vendor', $this->getVendor());
  357. $group = \OC::$server->getGroupManager()->createGroup('admin');
  358. if ($group instanceof IGroup) {
  359. $group->addUser($user);
  360. }
  361. // Install shipped apps and specified app bundles
  362. Installer::installShippedApps();
  363. $bundleFetcher = new BundleFetcher(\OC::$server->getL10N('lib'));
  364. $defaultInstallationBundles = $bundleFetcher->getDefaultInstallationBundle();
  365. foreach ($defaultInstallationBundles as $bundle) {
  366. try {
  367. $this->installer->installAppBundle($bundle);
  368. } catch (Exception $e) {
  369. }
  370. }
  371. // create empty file in data dir, so we can later find
  372. // out that this is indeed an ownCloud data directory
  373. file_put_contents($config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/.ocdata', '');
  374. // Update .htaccess files
  375. self::updateHtaccess();
  376. self::protectDataDirectory();
  377. self::installBackgroundJobs();
  378. //and we are done
  379. $config->setSystemValue('installed', true);
  380. // Create a session token for the newly created user
  381. // The token provider requires a working db, so it's not injected on setup
  382. /* @var $userSession User\Session */
  383. $userSession = \OC::$server->getUserSession();
  384. $defaultTokenProvider = \OC::$server->query(DefaultTokenProvider::class);
  385. $userSession->setTokenProvider($defaultTokenProvider);
  386. $userSession->login($username, $password);
  387. $userSession->createSessionToken($request, $userSession->getUser()->getUID(), $username, $password);
  388. $session = $userSession->getSession();
  389. $session->set('last-password-confirm', \OC::$server->query(ITimeFactory::class)->getTime());
  390. // Set email for admin
  391. if (!empty($options['adminemail'])) {
  392. $user->setSystemEMailAddress($options['adminemail']);
  393. }
  394. }
  395. return $error;
  396. }
  397. public static function installBackgroundJobs() {
  398. $jobList = \OC::$server->getJobList();
  399. $jobList->add(DefaultTokenCleanupJob::class);
  400. $jobList->add(Rotate::class);
  401. $jobList->add(BackgroundCleanupJob::class);
  402. }
  403. /**
  404. * @return string Absolute path to htaccess
  405. */
  406. private function pathToHtaccess() {
  407. return \OC::$SERVERROOT . '/.htaccess';
  408. }
  409. /**
  410. * Find webroot from config
  411. *
  412. * @param SystemConfig $config
  413. * @return string
  414. * @throws InvalidArgumentException when invalid value for overwrite.cli.url
  415. */
  416. private static function findWebRoot(SystemConfig $config): string {
  417. // For CLI read the value from overwrite.cli.url
  418. if (\OC::$CLI) {
  419. $webRoot = $config->getValue('overwrite.cli.url', '');
  420. if ($webRoot === '') {
  421. throw new InvalidArgumentException('overwrite.cli.url is empty');
  422. }
  423. if (!filter_var($webRoot, FILTER_VALIDATE_URL)) {
  424. throw new InvalidArgumentException('invalid value for overwrite.cli.url');
  425. }
  426. $webRoot = rtrim(parse_url($webRoot, PHP_URL_PATH), '/');
  427. } else {
  428. $webRoot = !empty(\OC::$WEBROOT) ? \OC::$WEBROOT : '/';
  429. }
  430. return $webRoot;
  431. }
  432. /**
  433. * Append the correct ErrorDocument path for Apache hosts
  434. *
  435. * @return bool True when success, False otherwise
  436. * @throws \OCP\AppFramework\QueryException
  437. */
  438. public static function updateHtaccess() {
  439. $config = \OC::$server->getSystemConfig();
  440. try {
  441. $webRoot = self::findWebRoot($config);
  442. } catch (InvalidArgumentException $e) {
  443. return false;
  444. }
  445. $setupHelper = new \OC\Setup(
  446. $config,
  447. \OC::$server->get(IniGetWrapper::class),
  448. \OC::$server->getL10N('lib'),
  449. \OC::$server->query(Defaults::class),
  450. \OC::$server->get(LoggerInterface::class),
  451. \OC::$server->getSecureRandom(),
  452. \OC::$server->query(Installer::class)
  453. );
  454. $htaccessContent = file_get_contents($setupHelper->pathToHtaccess());
  455. $content = "#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####\n";
  456. $htaccessContent = explode($content, $htaccessContent, 2)[0];
  457. //custom 403 error page
  458. $content .= "\nErrorDocument 403 " . $webRoot . '/';
  459. //custom 404 error page
  460. $content .= "\nErrorDocument 404 " . $webRoot . '/';
  461. // Add rewrite rules if the RewriteBase is configured
  462. $rewriteBase = $config->getValue('htaccess.RewriteBase', '');
  463. if ($rewriteBase !== '') {
  464. $content .= "\n<IfModule mod_rewrite.c>";
  465. $content .= "\n Options -MultiViews";
  466. $content .= "\n RewriteRule ^core/js/oc.js$ index.php [PT,E=PATH_INFO:$1]";
  467. $content .= "\n RewriteRule ^core/preview.png$ index.php [PT,E=PATH_INFO:$1]";
  468. $content .= "\n RewriteCond %{REQUEST_FILENAME} !\\.(css|js|svg|gif|png|html|ttf|woff2?|ico|jpg|jpeg|map|webm|mp4|mp3|ogg|wav)$";
  469. $content .= "\n RewriteCond %{REQUEST_FILENAME} !/core/ajax/update\\.php";
  470. $content .= "\n RewriteCond %{REQUEST_FILENAME} !/core/img/(favicon\\.ico|manifest\\.json)$";
  471. $content .= "\n RewriteCond %{REQUEST_FILENAME} !/(cron|public|remote|status)\\.php";
  472. $content .= "\n RewriteCond %{REQUEST_FILENAME} !/ocs/v(1|2)\\.php";
  473. $content .= "\n RewriteCond %{REQUEST_FILENAME} !/robots\\.txt";
  474. $content .= "\n RewriteCond %{REQUEST_FILENAME} !/(ocm-provider|ocs-provider|updater)/";
  475. $content .= "\n RewriteCond %{REQUEST_URI} !^/\\.well-known/(acme-challenge|pki-validation)/.*";
  476. $content .= "\n RewriteCond %{REQUEST_FILENAME} !/richdocumentscode(_arm64)?/proxy.php$";
  477. $content .= "\n RewriteRule . index.php [PT,E=PATH_INFO:$1]";
  478. $content .= "\n RewriteBase " . $rewriteBase;
  479. $content .= "\n <IfModule mod_env.c>";
  480. $content .= "\n SetEnv front_controller_active true";
  481. $content .= "\n <IfModule mod_dir.c>";
  482. $content .= "\n DirectorySlash off";
  483. $content .= "\n </IfModule>";
  484. $content .= "\n </IfModule>";
  485. $content .= "\n</IfModule>";
  486. }
  487. if ($content !== '') {
  488. //suppress errors in case we don't have permissions for it
  489. return (bool)@file_put_contents($setupHelper->pathToHtaccess(), $htaccessContent . $content . "\n");
  490. }
  491. return false;
  492. }
  493. public static function protectDataDirectory() {
  494. //Require all denied
  495. $now = date('Y-m-d H:i:s');
  496. $content = "# Generated by Nextcloud on $now\n";
  497. $content .= "# Section for Apache 2.4 to 2.6\n";
  498. $content .= "<IfModule mod_authz_core.c>\n";
  499. $content .= " Require all denied\n";
  500. $content .= "</IfModule>\n";
  501. $content .= "<IfModule mod_access_compat.c>\n";
  502. $content .= " Order Allow,Deny\n";
  503. $content .= " Deny from all\n";
  504. $content .= " Satisfy All\n";
  505. $content .= "</IfModule>\n\n";
  506. $content .= "# Section for Apache 2.2\n";
  507. $content .= "<IfModule !mod_authz_core.c>\n";
  508. $content .= " <IfModule !mod_access_compat.c>\n";
  509. $content .= " <IfModule mod_authz_host.c>\n";
  510. $content .= " Order Allow,Deny\n";
  511. $content .= " Deny from all\n";
  512. $content .= " </IfModule>\n";
  513. $content .= " Satisfy All\n";
  514. $content .= " </IfModule>\n";
  515. $content .= "</IfModule>\n\n";
  516. $content .= "# Section for Apache 2.2 to 2.6\n";
  517. $content .= "<IfModule mod_autoindex.c>\n";
  518. $content .= " IndexIgnore *\n";
  519. $content .= "</IfModule>";
  520. $baseDir = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data');
  521. file_put_contents($baseDir . '/.htaccess', $content);
  522. file_put_contents($baseDir . '/index.html', '');
  523. }
  524. /**
  525. * Return vendor from which this version was published
  526. *
  527. * @return string Get the vendor
  528. *
  529. * Copy of \OC\Updater::getVendor()
  530. */
  531. private function getVendor() {
  532. // this should really be a JSON file
  533. require \OC::$SERVERROOT . '/version.php';
  534. /** @var string $vendor */
  535. return (string)$vendor;
  536. }
  537. }