This site is developed to XHTML and CSS2 W3C standards.
If you see this paragraph, your browser does not support those standards and you
need to upgrade. Visit WaSP
for a variety of options.
Posted by jmullan Wed 4th Jun 2008 03:03
/**
* Check that filesystem and db path components are in sync
* @access private
*/
function _checkDir($dir, $id) {
$platform =& $gallery->getPlatform();
$fsComponents = $dirs = array();
if (!($dh = $platform->opendir($dir))) {
return array(GalleryCoreApi:: error(ERROR_PLATFORM_FAILURE, null, null,
"Unable to opendir $dir"), null, null, null);
}
while (($file = $platform->readdir($dh)) !== false) {
if ($file == '.' || $file == '..') {
continue;
}
$fsComponents[$file] = true;
if ($platform->is_dir($dir . $file)) {
$dirs[$file] = true;
}
}
$platform->closedir($dh);
/* Skip linked entities (data file is elsewhere) and GalleryLinkItems (no data file) */
$query = '
SELECT
[GalleryFileSystemEntity::id], [GalleryFileSystemEntity::pathComponent]
FROM
[GalleryFileSystemEntity] INNER JOIN [GalleryChildEntity]
ON [GalleryFileSystemEntity::id] = [GalleryChildEntity::id]
INNER JOIN [GalleryEntity]
ON [GalleryFileSystemEntity::id] = [GalleryEntity::id]
WHERE
[GalleryChildEntity::parentId] = ?
AND
[GalleryEntity::linkId] IS NULL
AND
[GalleryEntity::entityType] <> ?
';
list ($ret, $results) = $gallery-> search($query, array((int )$id, 'GalleryLinkItem'));
if ($ret) {
return array($ret, null, null, null);
}
while ($result = $results->nextResult()) {
$dbComponents[(int)$result[0]] = $result[1];
}
return array(null, $dbComponents, $fsComponents, $dirs);
}
|
PermaLink to this entry http://tools.gallery2.org/pastebin/1993
Download 1993.txt
Submit a correction or amendment below. (click here to make a fresh posting)
Page generated in 0.139 seconds.