function outputItem($name, $shared) { $file = wfFindFile($name); if ($file && $this->filterItem($file, $shared)) { $filename = $file->getPath(); $rel = wfRelativePath($filename, $this->mBasePath); $this->output("{$rel}\n"); } else { wfDebug(__METHOD__ . ": base file? {$name}\n"); } }
/** * Returns information about all the included images in the format * more usable for sass file generating * * @return array */ protected function getSassImageAttributes() { global $IP; $images = array(); foreach ($this->images as $file => $data) { $name = $file; $i = strrpos($name, '.'); if ($i !== false) { $name = substr($name, 0, $i); } $relPath = $this->source . (substr($this->source, -1) == '/' ? '' : '/') . $file; $relPath = wfRelativePath($relPath, realpath($IP)); $images[] = array('file' => $file, 'relPath' => $relPath, 'name' => $name, 'x' => $data['x'] . 'px', 'y' => $data['y'] . 'px', 'width' => $data['width'] . 'px', 'height' => $data['height'] . 'px', 'details' => "{$data['x']},{$data['y']},{$data['md5']}"); } return $images; }
/** * Rename a given image or archived image file to the converted filename, * leaving a symlink for URL compatibility. * * @param string $oldname pre-conversion filename * @param string $basename pre-conversion base filename for dir hashing, if an archive * @access private */ function renameFile($oldname, $subdirCallback = 'wfImageDir', $basename = null) { $newname = $this->conv($oldname); if ($newname == $oldname) { // No need to rename; another field triggered this row. return false; } if (is_null($basename)) { $basename = $oldname; } $ubasename = $this->conv($basename); $oldpath = call_user_func($subdirCallback, $basename) . '/' . $oldname; $newpath = call_user_func($subdirCallback, $ubasename) . '/' . $newname; $this->log("{$oldpath} -> {$newpath}"); if (rename($oldpath, $newpath)) { $relpath = wfRelativePath($newpath, dirname($oldpath)); if (!symlink($relpath, $oldpath)) { $this->log("... symlink failed!"); } return $newname; } else { $this->log("... rename failed!"); return false; } }
/** * Update Extension Messages. * * @param $file String * @param $extension String * @param $verbose Boolean * * @return Integer: the amount of updated messages */ public static function updateExtensionMessages($file, $extension, $verbose) { global $IP, $wgLocalisationUpdateSVNURL; $relfile = wfRelativePath($file, "{$IP}/extensions"); // Create a full path. // TODO: add support for $wgExtensionAssetsPath // $localfile = "$IP/extensions/$relfile"; // Get the full SVN directory path. // TODO: add support for $wgExtensionAssetsPath $svnfile = "{$wgLocalisationUpdateSVNURL}/extensions/{$relfile}"; // Compare the 2 files. $result = self::compareExtensionFiles($extension, $svnfile, $file, $verbose, false, true); return $result; }