Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 873a67d

Browse files
committed
interface VersioncontrolItemDirectoryContents
it allow us to avoid the vc callback get_directory_contents
1 parent 1e3ed2c commit 873a67d

2 files changed

Lines changed: 8 additions & 12 deletions

File tree

‎includes/VersioncontrolItem.php‎

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -617,13 +617,8 @@ public final function getParallelItems($label_type_filter = NULL) {
617617
* inside the given directory in the repository.
618618
*
619619
* This function is optional for VCS backends to implement, be sure to check
620-
* with versioncontrol_backend_implements($repository['vcs'], 'get_directory_contents')
621-
* if the particular backend actually implements it.
620+
* the return value to NULL.
622621
*
623-
* @param $repository
624-
* The repository that the directory item is located in.
625-
* @param $directory_item
626-
* The parent item of the items that should be listed.
627622
* @param $recursive
628623
* If FALSE, only the direct children of $path will be retrieved.
629624
* If TRUE, you'll get every single descendant of $path.
@@ -647,14 +642,11 @@ public final function getParallelItems($label_type_filter = NULL) {
647642
* A real-life example of such a result array can be found
648643
* in the FakeVCS example module.
649644
*/
650-
public function getDirectoryContents($repository, $directory_item, $recursive = FALSE) {
651-
if (!versioncontrol_is_directory_item($directory_item)) {
645+
public function getDirectoryContents($recursive = FALSE) {
646+
if (!$this->isDirectory() || $thisinstanceof VersioncontrolItemDirectoryContents) {
652647
return NULL;
653648
}
654-
$contents = _versioncontrol_call_backend(
655-
$repository['vcs'], 'get_directory_contents',
656-
array($repository, $directory_item, $recursive)
657-
);
649+
$this->_getDirectoryContents($recursive);
658650
if (!isset($contents)) {
659651
return NULL;
660652
}

‎includes/classes.inc‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,7 @@ final class VersioncontrolRepositoryCache {
176176
interface VersioncontrolItemParallelItems {
177177
function _getParallelItems($label_type_filter = NULL);
178178
}
179+
180+
interface VersioncontrolItemDirectoryContents {
181+
function _getDirectoryContents($recursive = FALSE);
182+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /