Example #1
0
 /**
  * Load all pages and docs.
  *
  * @param string $start      page/doc to start with for the return
  * @param int    $pageLength page length (leave null to use default)
  *
  * @return void
  */
 protected function loadPagesAndDocs($start, $pageLength)
 {
     // Set default page length if necessary
     if ($pageLength == null) {
         $pageLength = $this->connector->getPageLength();
     }
     // Get data on all pages and docs
     foreach ($this->queue as $parent => $items) {
         $this->outline['counts'][$parent] = count($items);
         if (count($items) < $start) {
             continue;
         }
         $this->outline['lists'][$parent] = [];
         for ($i = $start; $i < $start + $pageLength; $i++) {
             if ($i >= count($items)) {
                 break;
             }
             $id = $items[$i];
             // If there's a cache of this page...
             $item = $this->getCache(md5($id), $this->moddate[$parent]);
             if (!$item) {
                 $item = $this->buildItem($id);
                 $this->setCache(md5($id), $item);
             }
             $this->outline['lists'][$parent][$i] = $item;
         }
     }
 }