diff --git a/src/applications/base/controller/PhabricatorController.php b/src/applications/base/controller/PhabricatorController.php --- a/src/applications/base/controller/PhabricatorController.php +++ b/src/applications/base/controller/PhabricatorController.php @@ -527,7 +527,7 @@ } protected function buildTransactionTimeline( - PhabricatorLiskDAO $object, + PhabricatorApplicationTransactionInterface $object, PhabricatorApplicationTransactionQuery $query, PhabricatorMarkupEngine $engine = null) { diff --git a/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php b/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php --- a/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php +++ b/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php @@ -39,24 +39,7 @@ $root = dirname(phutil_get_library_root('phabricator')); $auto_root = $root.'/resources/sql/autopatches/'; - $auto_list = Filesystem::listDirectory($auto_root, $include_hidden = false); - sort($auto_list); - - foreach ($auto_list as $auto_patch) { - $matches = null; - if (!preg_match('/\.(sql|php)$/', $auto_patch, $matches)) { - throw new Exception( - pht( - 'Unknown patch "%s" in "%s", expected ".php" or ".sql" suffix.', - $auto_patch, - $auto_root)); - } - - $patches[$auto_patch] = array( - 'type' => $matches[1], - 'name' => $auto_root.$auto_patch, - ); - } + $patches += $this->buildPatchesFromDirectory($auto_root); return $patches; } diff --git a/src/infrastructure/storage/patch/PhabricatorSQLPatchList.php b/src/infrastructure/storage/patch/PhabricatorSQLPatchList.php --- a/src/infrastructure/storage/patch/PhabricatorSQLPatchList.php +++ b/src/infrastructure/storage/patch/PhabricatorSQLPatchList.php @@ -5,6 +5,37 @@ abstract function getNamespace(); abstract function getPatches(); + /** + * Examine a directory for `.php` and `.sql` files and build patch + * specifications for them. + */ + protected function buildPatchesFromDirectory($directory) { + $patch_list = Filesystem::listDirectory( + $directory, + $include_hidden = false); + + sort($patch_list); + $patches = array(); + + foreach ($patch_list as $patch) { + $matches = null; + if (!preg_match('/\.(sql|php)$/', $patch, $matches)) { + throw new Exception( + pht( + 'Unknown patch "%s" in "%s", expected ".php" or ".sql" suffix.', + $patch, + $directory)); + } + + $patches[$patch] = array( + 'type' => $matches[1], + 'name' => rtrim($directory, '/').'/'.$patch, + ); + } + + return $patches; + } + final public static function buildAllPatches() { $patch_lists = id(new PhutilSymbolLoader()) ->setAncestorClass('PhabricatorSQLPatchList')