/** * Called by img_auth.php when a file has fully been sent to a client * @param Title $title * @param string $filename * @return boolean Always returns true */ public static function onImgAuthFullyStreamedFile(&$title, $filename) { $namespace = $title->getNamespace(); $db_key = $title->getDBkey(); // skip if the file looks not attached to a wikiplace if (!WpPage::isInWikiplace($namespace, $db_key)) { return true; // nothing to do } // get file infos $stat = stat($filename); if (!$stat) { return true; // should not occur, but just in case, avoid a PHP error } // prepare update infos $root = WpWikiplace::extractWikiplaceRoot($db_key, $namespace); $size = $stat['size']; // in bytes WpWikiplace::updateBandwidthUsage($root, $size); return true; }