예제 #1
0
파일: modslib.php 프로젝트: rjsmelo/tiki
 /**
  * @param $dir
  */
 function rebuild_list($dir)
 {
     $list = array();
     $h = opendir($dir);
     while ($file = readdir($h)) {
         if (substr($file, -9, 9) == '.info.txt') {
             $list[] = $file;
         }
     }
     closedir($h);
     $fp = fopen($dir . '/00_list.txt', 'w');
     if (count($list)) {
         foreach ($list as $l) {
             $l = substr($l, 0, -9);
             $pos = strpos($l, '-');
             $type = substr($l, 0, $pos);
             $name = substr($l, $pos + 1);
             $detail = new TikiModInfo($type, $name);
             $err = $detail->readinfo($dir . '/' . $l . '.info.txt');
             if ($err !== FALSE) {
                 $this->feedback_error($err);
                 continue;
             }
             fputs($fp, $detail->toline() . "\n");
         }
     } else {
         fputs($fp, "# nothing installed");
     }
     fclose($fp);
 }