apps.php 881 B

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