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.

Gallery Pastebin - Paste and link to it

Posted by jmullan Wed 4th Jun 2008 03:03

  1. /**
  2.      * Check that filesystem and db path components are in sync
  3.      * @access private
  4.      */
  5.     function _checkDir($dir, $id) {
  6.         global $gallery;
  7.         $platform =& $gallery->getPlatform();
  8.         $fsComponents = $dirs = array();
  9.         if (!($dh = $platform->opendir($dir))) {
  10.             return array(GalleryCoreApi::error(ERROR_PLATFORM_FAILURE, null, null,
  11.                                                "Unable to opendir $dir"), null, null, null);
  12.         }
  13.         while (($file = $platform->readdir($dh)) !== false) {
  14.             if ($file == '.' || $file == '..') {
  15.                 continue;
  16.             }
  17.             $fsComponents[$file] = true;
  18.             if ($platform->is_dir($dir . $file)) {
  19.                 $dirs[$file] = true;
  20.             }
  21.         }
  22.         $platform->closedir($dh);
  23.  
  24.         /* Skip linked entities (data file is elsewhere) and GalleryLinkItems (no data file) */
  25.         $query = '
  26.         SELECT
  27.           [GalleryFileSystemEntity::id], [GalleryFileSystemEntity::pathComponent]
  28.         FROM
  29.           [GalleryFileSystemEntity] INNER JOIN [GalleryChildEntity]
  30.                                     ON [GalleryFileSystemEntity::id] = [GalleryChildEntity::id]
  31.                                     INNER JOIN [GalleryEntity]
  32.                                     ON [GalleryFileSystemEntity::id] = [GalleryEntity::id]
  33.         WHERE
  34.           [GalleryChildEntity::parentId] = ?
  35.           AND
  36.           [GalleryEntity::linkId] IS NULL
  37.           AND
  38.           [GalleryEntity::entityType] <> ?
  39.         ';
  40.         list ($ret, $results) = $gallery->search($query, array((int)$id, 'GalleryLinkItem'));
  41.         if ($ret) {
  42.             return array($ret, null, null, null);
  43.         }
  44.         $dbComponents = array();
  45.         while ($result = $results->nextResult()) {
  46.             $dbComponents[(int)$result[0]] = $result[1];
  47.         }
  48.  
  49.         return array(null, $dbComponents, $fsComponents, $dirs);
  50.     }

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)

Your Name
Syntax:
For (optional)
Leave permalink as note for user. Remember my name in a cookie

Select channel for announcement:
#gallery#gallery-support

Code: To ensure legibility, keep your code lines under 80 characters long.

You can highlight lines: start with "@#" and end with "!#"

Description: You can leave a small description for your code. (Errors, etc)

Please note that your script will be available publicly.
Page generated in 0.139 seconds.