apps.php 931 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 ($dh = opendir($path)) {
  13. while ($name = readdir($dh)) {
  14. if ($name[0] !== '.') {
  15. $file = $path . '/' . $name;
  16. if (is_dir($file)) {
  17. loadDirectory($file);
  18. } elseif (substr($name, -4, 4) === '.php') {
  19. require_once $file;
  20. }
  21. }
  22. }
  23. }
  24. }
  25. function getSubclasses($parentClassName) {
  26. $classes = array();
  27. foreach (get_declared_classes() as $className) {
  28. if (is_subclass_of($className, $parentClassName))
  29. $classes[] = $className;
  30. }
  31. return $classes;
  32. }
  33. $apps = OC_App::getEnabledApps();
  34. foreach ($apps as $app) {
  35. $dir = OC_App::getAppPath($app);
  36. if (is_dir($dir . '/tests')) {
  37. loadDirectory($dir . '/tests');
  38. }
  39. }