Setup.php 19 KB

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