#!/usr/bin/env php . */ define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..')); $longoptions = array('dry-run'); $helptext = <<title = 'h'; $f->mimetype = 'h'; $f->size = 0; $f->protected = 0; $f->find(); echo "Found $f->N bad items:\n"; while ($f->fetch()) { echo "$f->id $f->url"; $data = File_redirection::lookupWhere($f->url); if ($dry) { if (is_array($data)) { echo " (unchanged)\n"; } else { echo " (unchanged, but embedding lookup failed)\n"; } } else { // NULL out the mime/title/size/protected fields $sql = sprintf("UPDATE file " . "SET mimetype=null,title=null,size=null,protected=null " . "WHERE id=%d", $f->id); $f->query($sql); $f->decache(); if (is_array($data)) { Event::handle('EndFileSaveNew', array($f, $data, $f->url)); echo " (ok)\n"; } else { echo " (ok, but embedding lookup failed)\n"; } } } echo "done.\n";