Advertisement
Guest User

Untitled

a guest
Jul 14th, 2020
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.78 KB | None | 0 0
  1. Starting PHP-fpm
  2. Starting Apache
  3. Starting mariaDB
  4. Starting Redis
  5. 2020-07-13 3:21:03 0 [Note] mysqld (mysqld 10.3.22-MariaDB-0+deb10u1) starting as process 224 ...
  6. Starting Cron
  7. Starting Postfix
  8. will then fallback to the framework/ directory if not
  9. * found before giving up.
  10. *
  11. * This class is loosely based on the Symfony UniversalClassLoader.
  12. *
  13. * @author Fabien Potencier <fabien@symfony.com>
  14. * @author Jordi Boggiano <j.boggiano@seld.be>
  15. * @see http://www.php-fig.org/psr/psr-0/
  16. * @see http://www.php-fig.org/psr/psr-4/
  17. */
  18. class ClassLoader
  19. {
  20. // PSR-4
  21. private $prefixLengthsPsr4 = array();
  22. private $prefixDirsPsr4 = array();
  23. private $fallbackDirsPsr4 = array();
  24.  
  25. // PSR-0
  26. private $prefixesPsr0 = array();
  27. private $fallbackDirsPsr0 = array();
  28.  
  29. private $useIncludePath = false;
  30. private $classMap = array();
  31. private $classMapAuthoritative = false;
  32. private $missingClasses = array();
  33. private $apcuPrefix;
  34.  
  35. public function getPrefixes()
  36. {
  37. if (!empty($this->prefixesPsr0)) {
  38. return call_user_func_array('array_merge', $this->prefixesPsr0);
  39. }
  40.  
  41. return array();
  42. }
  43.  
  44. public function getPrefixesPsr4()
  45. {
  46. return $this->prefixDirsPsr4;
  47. }
  48.  
  49. public function getFallbackDirs()
  50. {
  51. return $this->fallbackDirsPsr0;
  52. }
  53.  
  54. public function getFallbackDirsPsr4()
  55. {
  56. return $this->fallbackDirsPsr4;
  57. }
  58.  
  59. public function getClassMap()
  60. {
  61. return $this->classMap;
  62. }
  63.  
  64. /**
  65. * @param array $classMap Class to filename map
  66. */
  67. public function addClassMap(array $classMap)
  68. {
  69. if ($this->classMap) {
  70. $this->classMap = array_merge($this->classMap, $classMap);
  71. } else {
  72. $this->classMap = $classMap;
  73. }
  74. }
  75.  
  76. /**
  77. * Registers a set of PSR-0 directories for a given prefix, either
  78. * appending or prepending to the ones previously set for this prefix.
  79. *
  80. * @param string $prefix The prefix
  81. * @param array|string $paths The PSR-0 root directories
  82. * @param bool $prepend Whether to prepend the directories
  83. */
  84. public function add($prefix, $paths, $prepend = false)
  85. {
  86. if (!$prefix) {
  87. if ($prepend) {
  88. $this->fallbackDirsPsr0 = array_merge(
  89. (array) $paths,
  90. $this->fallbackDirsPsr0
  91. );
  92. } else {
  93. $this->fallbackDirsPsr0 = array_merge(
  94. $this->fallbackDirsPsr0,
  95. (array) $paths
  96. );
  97. }
  98.  
  99. return;
  100. }
  101.  
  102. $first = $prefix[0];
  103. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  104. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  105.  
  106. return;
  107. }
  108. if ($prepend) {
  109. $this->prefixesPsr0[$first][$prefix] = array_merge(
  110. (array) $paths,
  111. $this->prefixesPsr0[$first][$prefix]
  112. );
  113. } else {
  114. $this->prefixesPsr0[$first][$prefix] = array_merge(
  115. $this->prefixesPsr0[$first][$prefix],
  116. (array) $paths
  117. );
  118. }
  119. }
  120.  
  121. /**
  122. * Registers a set of PSR-4 directories for a given namespace, either
  123. * appending or prepending to the ones previously set for this namespace.
  124. *
  125. * @param string $prefix The prefix/namespace, with trailing '\\'
  126. * @param array|string $paths The PSR-4 base directories
  127. * @param bool $prepend Whether to prepend the directories
  128. *
  129. * @throws \InvalidArgumentException
  130. */
  131. public function addPsr4($prefix, $paths, $prepend = false)
  132. {
  133. if (!$prefix) {
  134. // Register directories for the root namespace.
  135. if ($prepend) {
  136. $this->fallbackDirsPsr4 = array_merge(
  137. (array) $paths,
  138. $this->fallbackDirsPsr4
  139. );
  140. } else {
  141. $this->fallbackDirsPsr4 = array_merge(
  142. $this->fallbackDirsPsr4,
  143. (array) $paths
  144. );
  145. }
  146. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  147. // Register directories for a new namespace.
  148. $length = strlen($prefix);
  149. if ('\\' !== $prefix[$length - 1]) {
  150. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  151. }
  152. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  153. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  154. } elseif ($prepend) {
  155. // Prepend directories for an already registered namespace.
  156. $this->prefixDirsPsr4[$prefix] = array_merge(
  157. (array) $paths,
  158. $this->prefixDirsPsr4[$prefix]
  159. );
  160. } else {
  161. // Append directories for an already registered namespace.
  162. $this->prefixDirsPsr4[$prefix] = array_merge(
  163. $this->prefixDirsPsr4[$prefix],
  164. (array) $paths
  165. );
  166. }
  167. }
  168.  
  169. /**
  170. * Registers a set of PSR-0 directories for a given prefix,
  171. * replacing any others previously set for this prefix.
  172. *
  173. * @param string $prefix The prefix
  174. * @param array|string $paths The PSR-0 base directories
  175. */
  176. public function set($prefix, $paths)
  177. {
  178. if (!$prefix) {
  179. $this->fallbackDirsPsr0 = (array) $paths;
  180. } else {
  181. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  182. }
  183. }
  184.  
  185. /**
  186. * Registers a set of PSR-4 directories for a given namespace,
  187. * replacing any others previously set for this namespace.
  188. *
  189. * @param string $prefix The prefix/namespace, with trailing '\\'
  190. * @param array|string $paths The PSR-4 base directories
  191. *
  192. * @throws \InvalidArgumentException
  193. */
  194. public function setPsr4($prefix, $paths)
  195. {
  196. if (!$prefix) {
  197. $this->fallbackDirsPsr4 = (array) $paths;
  198. } else {
  199. $length = strlen($prefix);
  200. if ('\\' !== $prefix[$length - 1]) {
  201. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  202. }
  203. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  204. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  205. }
  206. }
  207.  
  208. /**
  209. * Turns on searching the include path for class files.
  210. *
  211. * @param bool $useIncludePath
  212. */
  213. public function setUseIncludePath($useIncludePath)
  214. {
  215. $this->useIncludePath = $useIncludePath;
  216. }
  217.  
  218. /**
  219. * Can be used to check if the autoloader uses the include path to check
  220. * for classes.
  221. *
  222. * @return bool
  223. */
  224. public function getUseIncludePath()
  225. {
  226. return $this->useIncludePath;
  227. }
  228.  
  229. /**
  230. * Turns off searching the prefix and fallback directories for classes
  231. * that have not been registered with the class map.
  232. *
  233. * @param bool $classMapAuthoritative
  234. */
  235. public function setClassMapAuthoritative($classMapAuthoritative)
  236. {
  237. $this->classMapAuthoritative = $classMapAuthoritative;
  238. }
  239.  
  240. /**
  241. * Should class lookup fail if not found in the current class map?
  242. *
  243. * @return bool
  244. */
  245. public function isClassMapAuthoritative()
  246. {
  247. return $this->classMapAuthoritative;
  248. }
  249.  
  250. /**
  251. * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
  252. *
  253. * @param string|null $apcuPrefix
  254. */
  255. public function setApcuPrefix($apcuPrefix)
  256. {
  257. $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
  258. }
  259.  
  260. /**
  261. * The APCu prefix in use, or null if APCu caching is not enabled.
  262. *
  263. * @return string|null
  264. */
  265. public function getApcuPrefix()
  266. {
  267. return $this->apcuPrefix;
  268. }
  269.  
  270. /**
  271. * Registers this instance as an autoloader.
  272. *
  273. * @param bool $prepend Whether to prepend the autoloader or not
  274. */
  275. public function register($prepend = false)
  276. {
  277. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  278. }
  279.  
  280. /**
  281. * Unregisters this instance as an autoloader.
  282. */
  283. public function unregister()
  284. {
  285. spl_autoload_unregister(array($this, 'loadClass'));
  286. }
  287.  
  288. /**
  289. * Loads the given class or interface.
  290. *
  291. * @param string $class The name of the class
  292. * @return bool|null True if loaded, null otherwise
  293. */
  294. public function loadClass($class)
  295. {
  296. if ($file = $this->findFile($class)) {
  297. includeFile($file);
  298.  
  299. return true;
  300. }
  301. }
  302.  
  303. /**
  304. * Finds the path to the file where the class is defined.
  305. *
  306. * @param string $class The name of the class
  307. *
  308. * @return string|false The path if found, false otherwise
  309. */
  310. public function findFile($class)
  311. {
  312. // class map lookup
  313. if (isset($this->classMap[$class])) {
  314. return $this->classMap[$class];
  315. }
  316. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  317. return false;
  318. }
  319. if (null !== $this->apcuPrefix) {
  320. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  321. if ($hit) {
  322. return $file;
  323. }
  324. }
  325.  
  326. $file = $this->findFileWithExtension($class, '.php');
  327.  
  328. // Search for Hack files if we are running on HHVM
  329. if (false === $file && defined('HHVM_VERSION')) {
  330. $file = $this->findFileWithExtension($class, '.hh');
  331. }
  332.  
  333. if (null !== $this->apcuPrefix) {
  334. apcu_add($this->apcuPrefix.$class, $file);
  335. }
  336.  
  337. if (false === $file) {
  338. // Remember that this class does not exist.
  339. $this->missingClasses[$class] = true;
  340. }
  341.  
  342. return $file;
  343. }
  344.  
  345. private function findFileWithExtension($class, $ext)
  346. {
  347. // PSR-4 lookup
  348. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  349.  
  350. $first = $class[0];
  351. if (isset($this->prefixLengthsPsr4[$first])) {
  352. $subPath = $class;
  353. while (false !== $lastPos = strrpos($subPath, '\\')) {
  354. $subPath = substr($subPath, 0, $lastPos);
  355. $search = $subPath . '\\';
  356. if (isset($this->prefixDirsPsr4[$search])) {
  357. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  358. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  359. if (file_exists($file = $dir . $pathEnd)) {
  360. return $file;
  361. }
  362. }
  363. }
  364. }
  365. }
  366.  
  367. // PSR-4 fallback dirs
  368. foreach ($this->fallbackDirsPsr4 as $dir) {
  369. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  370. return $file;
  371. }
  372. }
  373.  
  374. // PSR-0 lookup
  375. if (false !== $pos = strrpos($class, '\\')) {
  376. // namespaced class name
  377. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  378. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  379. } else {
  380. // PEAR-like class name
  381. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  382. }
  383.  
  384. if (isset($this->prefixesPsr0[$first])) {
  385. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  386. if (0 === strpos($class, $prefix)) {
  387. foreach ($dirs as $dir) {
  388. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  389. return $file;
  390. }
  391. }
  392. }
  393. }
  394. }
  395.  
  396. // PSR-0 fallback dirs
  397. foreach ($this->fallbackDirsPsr0 as $dir) {
  398. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  399. return $file;
  400. }
  401. }
  402.  
  403. // PSR-0 include paths.
  404. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  405. return $file;
  406. }
  407.  
  408. return false;
  409. }
  410. }
  411.  
  412. /**
  413. * Scope isolated include.
  414. *
  415. * Prevents access to $this/self from included files.
  416. */
  417. function includeFile($file)
  418. {
  419. include $file;
  420. }
  421. An unhandled exception has been thrown:
  422. Error: Class 'Composer\Autoload\ClassLoader' not found in /data/nextcloud/lib/composer/composer/autoload_real.php:23
  423. Stack trace:
  424. #0 /data/nextcloud/lib/composer/autoload.php(7): ComposerAutoloaderInit53792487c5a8370acc0b06b1a864ff4c::getLoader()
  425. #1 /data/nextcloud/lib/base.php(579): require_once('/data/nextcloud...')
  426. #2 /data/nextcloud/lib/base.php(1089): OC::init()
  427. #3 /data/nextcloud/console.php(48): require_once('/data/nextcloud...')
  428. #4 /data/nextcloud/occ(11): require_once('/data/nextcloud...')
  429. #5 {main}Init done
  430. stopping Cron...
  431. stopping Redis...
  432. stopping Postfix...
  433. stopping logs...
  434. tail: no process found
  435. Stopping apache
  436. Stopping PHP-fpm
  437. Stopping mariaDB
  438. LAMP cleanup complete
  439. Starting PHP-fpm
  440. Starting Apache
  441. Starting mariaDB
  442. 2020-07-14 16:49:23 0 [Note] mysqld (mysqld 10.3.22-MariaDB-0+deb10u1) starting as process 224 ...
  443. Starting Redis
  444. Starting Cron
  445. Starting Postfix
  446. will then fallback to the framework/ directory if not
  447. * found before giving up.
  448. *
  449. * This class is loosely based on the Symfony UniversalClassLoader.
  450. *
  451. * @author Fabien Potencier <fabien@symfony.com>
  452. * @author Jordi Boggiano <j.boggiano@seld.be>
  453. * @see http://www.php-fig.org/psr/psr-0/
  454. * @see http://www.php-fig.org/psr/psr-4/
  455. */
  456. class ClassLoader
  457. {
  458. // PSR-4
  459. private $prefixLengthsPsr4 = array();
  460. private $prefixDirsPsr4 = array();
  461. private $fallbackDirsPsr4 = array();
  462.  
  463. // PSR-0
  464. private $prefixesPsr0 = array();
  465. private $fallbackDirsPsr0 = array();
  466.  
  467. private $useIncludePath = false;
  468. private $classMap = array();
  469. private $classMapAuthoritative = false;
  470. private $missingClasses = array();
  471. private $apcuPrefix;
  472.  
  473. public function getPrefixes()
  474. {
  475. if (!empty($this->prefixesPsr0)) {
  476. return call_user_func_array('array_merge', $this->prefixesPsr0);
  477. }
  478.  
  479. return array();
  480. }
  481.  
  482. public function getPrefixesPsr4()
  483. {
  484. return $this->prefixDirsPsr4;
  485. }
  486.  
  487. public function getFallbackDirs()
  488. {
  489. return $this->fallbackDirsPsr0;
  490. }
  491.  
  492. public function getFallbackDirsPsr4()
  493. {
  494. return $this->fallbackDirsPsr4;
  495. }
  496.  
  497. public function getClassMap()
  498. {
  499. return $this->classMap;
  500. }
  501.  
  502. /**
  503. * @param array $classMap Class to filename map
  504. */
  505. public function addClassMap(array $classMap)
  506. {
  507. if ($this->classMap) {
  508. $this->classMap = array_merge($this->classMap, $classMap);
  509. } else {
  510. $this->classMap = $classMap;
  511. }
  512. }
  513.  
  514. /**
  515. * Registers a set of PSR-0 directories for a given prefix, either
  516. * appending or prepending to the ones previously set for this prefix.
  517. *
  518. * @param string $prefix The prefix
  519. * @param array|string $paths The PSR-0 root directories
  520. * @param bool $prepend Whether to prepend the directories
  521. */
  522. public function add($prefix, $paths, $prepend = false)
  523. {
  524. if (!$prefix) {
  525. if ($prepend) {
  526. $this->fallbackDirsPsr0 = array_merge(
  527. (array) $paths,
  528. $this->fallbackDirsPsr0
  529. );
  530. } else {
  531. $this->fallbackDirsPsr0 = array_merge(
  532. $this->fallbackDirsPsr0,
  533. (array) $paths
  534. );
  535. }
  536.  
  537. return;
  538. }
  539.  
  540. $first = $prefix[0];
  541. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  542. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  543.  
  544. return;
  545. }
  546. if ($prepend) {
  547. $this->prefixesPsr0[$first][$prefix] = array_merge(
  548. (array) $paths,
  549. $this->prefixesPsr0[$first][$prefix]
  550. );
  551. } else {
  552. $this->prefixesPsr0[$first][$prefix] = array_merge(
  553. $this->prefixesPsr0[$first][$prefix],
  554. (array) $paths
  555. );
  556. }
  557. }
  558.  
  559. /**
  560. * Registers a set of PSR-4 directories for a given namespace, either
  561. * appending or prepending to the ones previously set for this namespace.
  562. *
  563. * @param string $prefix The prefix/namespace, with trailing '\\'
  564. * @param array|string $paths The PSR-4 base directories
  565. * @param bool $prepend Whether to prepend the directories
  566. *
  567. * @throws \InvalidArgumentException
  568. */
  569. public function addPsr4($prefix, $paths, $prepend = false)
  570. {
  571. if (!$prefix) {
  572. // Register directories for the root namespace.
  573. if ($prepend) {
  574. $this->fallbackDirsPsr4 = array_merge(
  575. (array) $paths,
  576. $this->fallbackDirsPsr4
  577. );
  578. } else {
  579. $this->fallbackDirsPsr4 = array_merge(
  580. $this->fallbackDirsPsr4,
  581. (array) $paths
  582. );
  583. }
  584. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  585. // Register directories for a new namespace.
  586. $length = strlen($prefix);
  587. if ('\\' !== $prefix[$length - 1]) {
  588. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  589. }
  590. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  591. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  592. } elseif ($prepend) {
  593. // Prepend directories for an already registered namespace.
  594. $this->prefixDirsPsr4[$prefix] = array_merge(
  595. (array) $paths,
  596. $this->prefixDirsPsr4[$prefix]
  597. );
  598. } else {
  599. // Append directories for an already registered namespace.
  600. $this->prefixDirsPsr4[$prefix] = array_merge(
  601. $this->prefixDirsPsr4[$prefix],
  602. (array) $paths
  603. );
  604. }
  605. }
  606.  
  607. /**
  608. * Registers a set of PSR-0 directories for a given prefix,
  609. * replacing any others previously set for this prefix.
  610. *
  611. * @param string $prefix The prefix
  612. * @param array|string $paths The PSR-0 base directories
  613. */
  614. public function set($prefix, $paths)
  615. {
  616. if (!$prefix) {
  617. $this->fallbackDirsPsr0 = (array) $paths;
  618. } else {
  619. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  620. }
  621. }
  622.  
  623. /**
  624. * Registers a set of PSR-4 directories for a given namespace,
  625. * replacing any others previously set for this namespace.
  626. *
  627. * @param string $prefix The prefix/namespace, with trailing '\\'
  628. * @param array|string $paths The PSR-4 base directories
  629. *
  630. * @throws \InvalidArgumentException
  631. */
  632. public function setPsr4($prefix, $paths)
  633. {
  634. if (!$prefix) {
  635. $this->fallbackDirsPsr4 = (array) $paths;
  636. } else {
  637. $length = strlen($prefix);
  638. if ('\\' !== $prefix[$length - 1]) {
  639. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  640. }
  641. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  642. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  643. }
  644. }
  645.  
  646. /**
  647. * Turns on searching the include path for class files.
  648. *
  649. * @param bool $useIncludePath
  650. */
  651. public function setUseIncludePath($useIncludePath)
  652. {
  653. $this->useIncludePath = $useIncludePath;
  654. }
  655.  
  656. /**
  657. * Can be used to check if the autoloader uses the include path to check
  658. * for classes.
  659. *
  660. * @return bool
  661. */
  662. public function getUseIncludePath()
  663. {
  664. return $this->useIncludePath;
  665. }
  666.  
  667. /**
  668. * Turns off searching the prefix and fallback directories for classes
  669. * that have not been registered with the class map.
  670. *
  671. * @param bool $classMapAuthoritative
  672. */
  673. public function setClassMapAuthoritative($classMapAuthoritative)
  674. {
  675. $this->classMapAuthoritative = $classMapAuthoritative;
  676. }
  677.  
  678. /**
  679. * Should class lookup fail if not found in the current class map?
  680. *
  681. * @return bool
  682. */
  683. public function isClassMapAuthoritative()
  684. {
  685. return $this->classMapAuthoritative;
  686. }
  687.  
  688. /**
  689. * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
  690. *
  691. * @param string|null $apcuPrefix
  692. */
  693. public function setApcuPrefix($apcuPrefix)
  694. {
  695. $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
  696. }
  697.  
  698. /**
  699. * The APCu prefix in use, or null if APCu caching is not enabled.
  700. *
  701. * @return string|null
  702. */
  703. public function getApcuPrefix()
  704. {
  705. return $this->apcuPrefix;
  706. }
  707.  
  708. /**
  709. * Registers this instance as an autoloader.
  710. *
  711. * @param bool $prepend Whether to prepend the autoloader or not
  712. */
  713. public function register($prepend = false)
  714. {
  715. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  716. }
  717.  
  718. /**
  719. * Unregisters this instance as an autoloader.
  720. */
  721. public function unregister()
  722. {
  723. spl_autoload_unregister(array($this, 'loadClass'));
  724. }
  725.  
  726. /**
  727. * Loads the given class or interface.
  728. *
  729. * @param string $class The name of the class
  730. * @return bool|null True if loaded, null otherwise
  731. */
  732. public function loadClass($class)
  733. {
  734. if ($file = $this->findFile($class)) {
  735. includeFile($file);
  736.  
  737. return true;
  738. }
  739. }
  740.  
  741. /**
  742. * Finds the path to the file where the class is defined.
  743. *
  744. * @param string $class The name of the class
  745. *
  746. * @return string|false The path if found, false otherwise
  747. */
  748. public function findFile($class)
  749. {
  750. // class map lookup
  751. if (isset($this->classMap[$class])) {
  752. return $this->classMap[$class];
  753. }
  754. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  755. return false;
  756. }
  757. if (null !== $this->apcuPrefix) {
  758. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  759. if ($hit) {
  760. return $file;
  761. }
  762. }
  763.  
  764. $file = $this->findFileWithExtension($class, '.php');
  765.  
  766. // Search for Hack files if we are running on HHVM
  767. if (false === $file && defined('HHVM_VERSION')) {
  768. $file = $this->findFileWithExtension($class, '.hh');
  769. }
  770.  
  771. if (null !== $this->apcuPrefix) {
  772. apcu_add($this->apcuPrefix.$class, $file);
  773. }
  774.  
  775. if (false === $file) {
  776. // Remember that this class does not exist.
  777. $this->missingClasses[$class] = true;
  778. }
  779.  
  780. return $file;
  781. }
  782.  
  783. private function findFileWithExtension($class, $ext)
  784. {
  785. // PSR-4 lookup
  786. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  787.  
  788. $first = $class[0];
  789. if (isset($this->prefixLengthsPsr4[$first])) {
  790. $subPath = $class;
  791. while (false !== $lastPos = strrpos($subPath, '\\')) {
  792. $subPath = substr($subPath, 0, $lastPos);
  793. $search = $subPath . '\\';
  794. if (isset($this->prefixDirsPsr4[$search])) {
  795. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  796. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  797. if (file_exists($file = $dir . $pathEnd)) {
  798. return $file;
  799. }
  800. }
  801. }
  802. }
  803. }
  804.  
  805. // PSR-4 fallback dirs
  806. foreach ($this->fallbackDirsPsr4 as $dir) {
  807. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  808. return $file;
  809. }
  810. }
  811.  
  812. // PSR-0 lookup
  813. if (false !== $pos = strrpos($class, '\\')) {
  814. // namespaced class name
  815. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  816. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  817. } else {
  818. // PEAR-like class name
  819. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  820. }
  821.  
  822. if (isset($this->prefixesPsr0[$first])) {
  823. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  824. if (0 === strpos($class, $prefix)) {
  825. foreach ($dirs as $dir) {
  826. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  827. return $file;
  828. }
  829. }
  830. }
  831. }
  832. }
  833.  
  834. // PSR-0 fallback dirs
  835. foreach ($this->fallbackDirsPsr0 as $dir) {
  836. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  837. return $file;
  838. }
  839. }
  840.  
  841. // PSR-0 include paths.
  842. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  843. return $file;
  844. }
  845.  
  846. return false;
  847. }
  848. }
  849.  
  850. /**
  851. * Scope isolated include.
  852. *
  853. * Prevents access to $this/self from included files.
  854. */
  855. function includeFile($file)
  856. {
  857. include $file;
  858. }
  859. An unhandled exception has been thrown:
  860. Error: Class 'Composer\Autoload\ClassLoader' not found in /data/nextcloud/lib/composer/composer/autoload_real.php:23
  861. Stack trace:
  862. #0 /data/nextcloud/lib/composer/autoload.php(7): ComposerAutoloaderInit53792487c5a8370acc0b06b1a864ff4c::getLoader()
  863. #1 /data/nextcloud/lib/base.php(579): require_once('/data/nextcloud...')
  864. #2 /data/nextcloud/lib/base.php(1089): OC::init()
  865. #3 /data/nextcloud/console.php(48): require_once('/data/nextcloud...')
  866. #4 /data/nextcloud/occ(11): require_once('/data/nextcloud...')
  867. #5 {main}Init done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement