Mercurial > hg > fapweb
diff faptool.php @ 1104:0a2117349f46
s/true/TRUE/g; s/false/FALSE/g;
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 14 May 2019 14:45:36 +0300 |
parents | 1f77195b4f95 |
children | b2bca5f6d0ff |
line wrap: on
line diff
--- a/faptool.php Tue May 14 14:12:42 2019 +0300 +++ b/faptool.php Tue May 14 14:45:36 2019 +0300 @@ -48,7 +48,7 @@ if (wtExec(wtGetExecutable("gfxconv"), wtGetExecutableArgs("gfxconv"). escapeshellarg($inFilename)." -f png -o ".escapeshellarg($tmpFilename), - 0) === false) + 0) === FALSE) return FALSE; if (!file_exists($tmpFilename)) @@ -225,7 +225,7 @@ // Save current working directory and chdir to target $cwd = getcwd(); - if (!is_dir($path) || chdir($path) === false) + if (!is_dir($path) || chdir($path) === FALSE) { echo "ERROR: Failed to chdir to '".$path."', can't unpack archive.\n"; return FALSE; @@ -256,7 +256,7 @@ { printf(" %03d | %s%s%s | %-40s | %-5s | %s\n", $entry["id"], - ($efile !== false) ? "E" : ".", + ($efile !== FALSE) ? "E" : ".", isset($pdata["file"]) ? "P" : ".", $pdata["valid"] ? "V" : ".", substr($entry["name"]." by ".$entry["author"], 0, 40), @@ -280,7 +280,7 @@ if (!isset($pdata["file"])) { // No source preview, check if we have entry file either? - if ($efile === false) + if ($efile === FALSE) { echo "INFO: No entry file for ".wtNiceName($compo, $entry, $efile). @@ -298,7 +298,7 @@ // Preview source file does not exist, let's see .. $edata = stProbeFileInfo($filename, TRUE); - if ($edata === false) + if ($edata === FALSE) { echo "ERROR: Invalid/unsupported file type for entry ".wtNiceName($compo, $entry, $efile)."\n"; @@ -311,12 +311,12 @@ // Entry is an archive file .. $path = stMakePath(FALSE, FALSE, array($setEntryPath, "UNPACKS", $efile["filename"])); - if (wtUnpackArchiveTo($efile["filetype"], $filename, $path) === false) + if (wtUnpackArchiveTo($efile["filetype"], $filename, $path) === FALSE) return FALSE; // Scan through files ... $dir = opendir($path); - while (($dentry = readdir($dir)) !== false) + while (($dentry = readdir($dir)) !== FALSE) { $fname = $path."/".$dentry; if ($dentry != "." && $dentry != "..") @@ -325,8 +325,8 @@ echo "XXX: ".$dentry." :: ".$fname."\n"; else if (is_file($fname) && - ($mdata = stProbeFileInfo($fname, TRUE)) !== false && - ($found = wtEntryToSource($compo, $fname, $mdata, $filename, $pdata, $outFilename, $force)) === true) + ($mdata = stProbeFileInfo($fname, TRUE)) !== FALSE && + ($found = wtEntryToSource($compo, $fname, $mdata, $filename, $pdata, $outFilename, $force)) === TRUE) break; } } @@ -451,7 +451,7 @@ function wtCropFilenamesRec($path, $len) { $dir = opendir($path); - while (($dentry = readdir($dir)) !== false) + while (($dentry = readdir($dir)) !== FALSE) { $fname = $path."/".$dentry; $nname = $path."/".wtCropFilename($dentry, $len); @@ -460,14 +460,14 @@ if (is_dir($fname)) { wtCropFilenamesRec($fname, $len); - if (rename($fname, $nname) === false) + if (rename($fname, $nname) === FALSE) { echo "ERROR: Could not rename DIR '".$fname."' -> '".$nname."'.\n"; return FALSE; } } else - if (is_file($fname) && rename($fname, $nname) === false) + if (is_file($fname) && rename($fname, $nname) === FALSE) { echo "ERROR: Could not rename FILE '".$fname."' -> '".$nname."'.\n"; return FALSE; @@ -483,7 +483,7 @@ global $setEntryPath; // Get latest file for the entry - if (($efile = stFetchSQL("SELECT * FROM files WHERE deleted=0 AND id=".$entry["file_id"])) === false) + if (($efile = stFetchSQL("SELECT * FROM files WHERE deleted=0 AND id=".$entry["file_id"])) === FALSE) { echo "INFO: No entry file for ".wtNiceName($compo, $entry, $efile)."\n"; return FALSE; @@ -501,7 +501,7 @@ // Get file data $edata = stProbeFileInfo($filename, TRUE); - if ($edata === false) + if ($edata === FALSE) { echo "ERROR: Invalid/unsupported file type for entry ".wtNiceName($compo, $entry, $efile)."\n"; @@ -537,7 +537,7 @@ $sbinfoStr = implode("\n", $sbinfo); // Create the destination directory - if (wtMakeDir(stMakePath(FALSE, FALSE, array($pathPrefix, $compo["cpath"])), 0755) === false) + if (wtMakeDir(stMakePath(FALSE, FALSE, array($pathPrefix, $compo["cpath"])), 0755) === FALSE) return FALSE; // Form the destination path and/or filename @@ -552,7 +552,7 @@ if ($copyOnly) { $dstFilename = stMakePath(FALSE, FALSE, array($pathPrefix, $compo["cpath"], $dstFileBase)); - if (copy($filename, $dstFilename) === false) + if (copy($filename, $dstFilename) === FALSE) { echo "ERROR: Failed to copy '".$filename."' to '".$dstFilename."'\n"; return FALSE; @@ -562,22 +562,22 @@ if ($edata["class"] == EFILE_ARCHIVE) { // Entry is an archive file, so unpack it - if (wtUnpackArchiveTo($edata["id"], $filename, $dstPath) === false) + if (wtUnpackArchiveTo($edata["id"], $filename, $dstPath) === FALSE) return FALSE; // Crop the filenames from the unpacked archive, if we need to - if ($cropNames !== false) + if ($cropNames !== FALSE) wtCropFilenamesRec($dstPath, $cropNames); } else { // We have a single file (or copyOnly mode) - if (wtMakeDir($dstPath, 0755) === false) + if (wtMakeDir($dstPath, 0755) === FALSE) return FALSE; $dstFilename = stMakePath(FALSE, FALSE, array($dstPath, wtCropFilename($efile["origname"], $cropNames))); - if (copy($filename, $dstFilename) === false) + if (copy($filename, $dstFilename) === FALSE) { echo "ERROR: Failed to copy '".$filename."' to '".$dstFilename."'\n"; return FALSE; @@ -606,7 +606,7 @@ $entry["id"], $entry["name"], $entry["author"], - ($efile !== false) ? " [".$efile["filename"]." / TYPE: '".$efile["filetype"]."']" : ""); + ($efile !== FALSE) ? " [".$efile["filename"]." / TYPE: '".$efile["filetype"]."']" : ""); } @@ -629,14 +629,14 @@ function wtExecOrDie($exe, $args) { - if (wtExec($exe, $args) === false) + if (wtExec($exe, $args) === FALSE) die(); } function wtPurgeDir($path) { - if ($path != "" && $path !== false && file_exists($path) && is_dir($path)) + if ($path != "" && $path !== FALSE && file_exists($path) && is_dir($path)) { // echo "PURGING: ".$path."\n"; foreach (scandir($path) as $file) @@ -658,7 +658,7 @@ if (!file_exists($path)) { echo "INFO: Creating ".$path."\n"; - if (mkdir($path, $perm, TRUE) === false) + if (mkdir($path, $perm, TRUE) === FALSE) die("Could not create directory '".$path."'\n"); } } @@ -784,7 +784,7 @@ // Try to connect to database $spec = stGetSetting("sqlDB"); -if (($db = stConnectSQLDBSpec($spec)) === false) +if (($db = stConnectSQLDBSpec($spec)) === FALSE) die("Could not connect to SQL database '".$spec."'.\n"); echo "Using database spec '".$spec."'.\n"; @@ -832,7 +832,7 @@ if ($argc < 2) die("No filename specified.\n"); - if (($finfo = finfo_open()) === false) + if (($finfo = finfo_open()) === FALSE) die("Internal error. Failed to initialize finfo()."); for ($i = 2; $i < $argc; $i++) @@ -848,7 +848,7 @@ "Probed : ".$sdata."\n". "Mime : ".$smime."\n"; - if (($info = stProbeFileInfo($filename, TRUE)) !== false) + if (($info = stProbeFileInfo($filename, TRUE)) !== FALSE) { $tmp = array(); foreach ($info as $ikey => $ival)