1) { for ($x = 1; $x < count($_SERVER['argv']); $x++) { if ($where) $where .= " OR "; $where .= "name LIKE '%" . Dba::escape(preg_replace("/[^a-z0-9\. -]/i", "", $_SERVER['argv'][$x])) . "%'"; } } if ($where) $where = "($where) AND catalog_type='local'"; else $where = "catalog_type='local'"; $sql = "SELECT id FROM catalog"; if ($where) $sql .= " WHERE $where"; $db_results = Dba::query($sql); while ($row = Dba::fetch_row($db_results)) { $catalog = new Catalog($row['0']); // Clean out dead files $catalog->clean_catalog(); // Verify Existing $catalog->verify_catalog($row['0']); echo "\n\n"; // Look for new files $catalog->add_to_catalog(); echo "\n\n"; } // end foreach ?>