apps.php 981 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. function loadDirectory($path) {
  9. if (strpos($path, 'integration')) {
  10. return;
  11. }
  12. if (strpos($path, 'Integration')) {
  13. return;
  14. }
  15. if ($dh = opendir($path)) {
  16. while ($name = readdir($dh)) {
  17. if ($name[0] !== '.') {
  18. $file = $path . '/' . $name;
  19. if (is_dir($file)) {
  20. loadDirectory($file);
  21. } elseif (substr($name, -4, 4) === '.php') {
  22. require_once $file;
  23. }
  24. }
  25. }
  26. }
  27. }
  28. function getSubclasses($parentClassName) {
  29. $classes = array();
  30. foreach (get_declared_classes() as $className) {
  31. if (is_subclass_of($className, $parentClassName))
  32. $classes[] = $className;
  33. }
  34. return $classes;
  35. }
  36. $apps = OC_App::getEnabledApps();
  37. foreach ($apps as $app) {
  38. $dir = OC_App::getAppPath($app);
  39. if (is_dir($dir . '/tests')) {
  40. loadDirectory($dir . '/tests');
  41. }
  42. }