This commit is contained in:
2019-10-06 06:46:23 -07:00
parent 5d96462b49
commit 1e37a7a134
494 changed files with 330 additions and 635207 deletions

View File

@@ -3,7 +3,7 @@
// Yuba
// //
//////////////////////////////////////////
$version = file_get_contents(__DIR__."/version.txt");
$version = file_get_contents(__DIR__."/current_version.txt");
ini_set('memory_limit', '10240M');
date_default_timezone_set("America/Los_Angeles");
@@ -46,11 +46,11 @@ if (@$argv[1] == "Preferences...") {
if (@$argv[1] == "Check for Updates...") {
$curr_version = file_get_contents("https://www.profiteroles.org/git/profiteroles/Yuba/raw/branch/master/version.txt");
$curr_version = file_get_contents("https://www.profiteroles.org/git/p/Yuba/raw/master/current_version.txt");
if ($curr_version > $version) {
if(askMulti("Yuba ".$curr_version." is available (you have ".$version.")", array("Cancel","Download")) == 1) {
exec("open http://git.profiteroles.org/profiteroles/Yuba");
die;
exec("open https://www.profiteroles.org/git/p/Yuba/");
echo "QUITAPP\n";
}
} else {
alert($version." is the latest version","Up-to-date");
@@ -91,6 +91,14 @@ ini_set("display_errors", TRUE);
ini_set("log_errors", TRUE);
ini_set("error_log", $error_log_file);
// Bundled QlGenerators
$generators = @glob(__DIR__."/../Library/Quicklook/*.qlgenerator");
if (!empty($generators)) {
foreach ($generators as $generator) {
$p['bundled_generators'][] = basename($generator);
}
}
// Banner
//////////////////////////////////////////
@@ -99,11 +107,13 @@ if (!is_dir($zpath) | !is_dir($bdest)) { echo "Filepath error"; die; }
$banner = "Yuba: ".$zpath." -> ".$bpath;
echo msg($banner."\n".str_repeat("-", strlen($banner)));
// Disk info
// System Info
//////////////////////////////////////////
echo msg("Gathering system info...");
// Disks
if (substr($zpath, 0, 9) != "/Volumes/") {
$zbase = "/";
} else {
@@ -115,16 +125,14 @@ $host = gethostname();
$disks = shell_exec("diskutil list -plist 2>&1");
$diskutil = shell_exec("diskutil info -plist ".$zbase." 2>&1");
$diskutil_parsed = $parser->parseString(utf8_for_xml($diskutil));
//print_r($diskutil_parsed);
foreach ($diskutil_parsed['SMARTDeviceSpecificKeysMayVaryNotGuaranteed'] as $key => $value) {
$diskutil_parsed[$key] = $value;
}
unset($diskutil_parsed['SMARTDeviceSpecificKeysMayVaryNotGuaranteed']);
$vdisks = shell_exec("hdiutil info -plist 2>&1");
$vdisks_parsed = $parser->parseString(utf8_for_xml($vdisks));
//print_r($vdisks_parsed);
$df = shell_exec("df 2>&1");
// old method, new method is to parse plist
//$df_volume = trim(shell_exec("df ".escapeshellarg($zpath)." | tail -n 1 | rev | cut -d' ' -f1 | rev"));
//$df_device = trim(shell_exec("df ".escapeshellarg($zpath)." | tail -n 1 | cut -d' ' -f1"));
$df_volume = $diskutil_parsed['MountPoint'];
$df_device = "/dev/".$diskutil_parsed['ParentWholeDisk'];
@@ -134,38 +142,10 @@ if (strpos($mdutil,"disabled")) {
$p['spotlight'] = false;
}
/////////////////////////////////////////////////////////////////////////////////////////////
// rewrite below to use diskutil info -plist
//
//
//
$olddiskutil = shell_exec("diskutil info ".$zbase." 2>&1");
$getdetail = array( "Volume Name",
"Protocol",
"Volume UUID",
"Device Location",
"Volume Total Space",
"Volume Available Space",
"Level Type"
);
foreach ($getdetail as $detail) {
preg_match("/(".$detail.":)(.*)(\n)/",$olddiskutil,$matches);
if (isset($matches[2])) {
if (substr($detail, -5, 5) == "Space") {
$pieces = explode(" ", trim($matches[2]));
$summary = $pieces[0]." ".$pieces[1];
$details[$detail] = $summary;
} else {
$details[$detail] = trim($matches[2]);
}
}
}
$dstring = serialize($details);
if ($zpath == "/") {
$type = "Startup disk";
} elseif (strtolower($zpath) == strtolower("/Volumes/".$details["Volume Name"])) {
if ($details["Protocol"] == "Disk Image") {
} elseif (strtolower($zpath) == strtolower("/Volumes/".$diskutil_parsed["VolumeName"])) {
if ($diskutil_parsed["BusProtocol"] == "Disk Image") {
$type = "Disk image";
} else {
$type = "External disk";
@@ -173,11 +153,6 @@ if ($zpath == "/") {
} else {
$type = "Folder";
}
//
//
//
/////////////////////////////////////////////////////////////////////////////////////////////
if ($type == "Disk image") {
$hdiutil = shell_exec("hdiutil imageinfo -plist ".$df_device." 2>&1");
@@ -191,15 +166,30 @@ if ($type == "Disk image") {
$image_file = false;
}
// System Profile
if ($p['profile']) {
echo msg("system_profiler");
$profile = shell_exec("system_profiler SPHardwareDataType SPStorageDataType SPThunderboltDataType SPUSBDataType 2>&1");
} else {
$profile = "disabled";
}
$qlmanage = shell_exec($bin_qlmanage." -m 2>&1");
$sysvers = shell_exec("sw_vers 2>&1");
// QuickLook
foreach (explode("\n",shell_exec($bin_qlmanage." -m plugins 2>&1")) as $ql_line) {
$ql_parts = @explode(" -> ",trim($ql_line));
if (@$ql_parts[1]) {
$qlmanage['plugins'][$ql_parts[0]] = $ql_parts[1];
}
}
$qlmanage['server'] = trim(shell_exec($bin_qlmanage." -m server 2>&1"));
$qlmanage['memory'] = trim(shell_exec($bin_qlmanage." -m memory 2>&1"));
$qlmanage['burst'] = trim(shell_exec($bin_qlmanage." -m burst 2>&1"));
$qlmanage['threads'] = trim(shell_exec($bin_qlmanage." -m threads 2>&1"));
$qlmanage['other'] = trim(shell_exec($bin_qlmanage." -m other 2>&1"));
// Database
//////////////////////////////////////////
@@ -230,7 +220,6 @@ $dbo->exec("CREATE TABLE _skim (
nodescended INTEGER,
ignored INTEGER,
dupes INTEGER,
details TEXT,
qlmanage TEXT,
sysvers TEXT,
disks TEXT,
@@ -292,7 +281,7 @@ $dbo->exec("CREATE TABLE files (
contents_filename TEXT
)");
$stmt = $dbo->prepare("INSERT INTO _skim VALUES (:version, :opts, :host, :uid, :zpath, :bpath, :type, :passed_file, :passed_dir, :passed_link, :passed_total, :nodescended, :ignored, :dupes, :details, :qlmanage, :sysvers, :disks, :diskutil, :vdisks, :hdiutil, :image_file, :df, :df_device, :df_volume, :mdutil, :profile, :status)");
$stmt = $dbo->prepare("INSERT INTO _skim VALUES (:version, :opts, :host, :uid, :zpath, :bpath, :type, :passed_file, :passed_dir, :passed_link, :passed_total, :nodescended, :ignored, :dupes, :qlmanage, :sysvers, :disks, :diskutil, :vdisks, :hdiutil, :image_file, :df, :df_device, :df_volume, :mdutil, :profile, :status)");
$stmt->BindValue(":version",$version);
$stmt->BindValue(":opts",serialize($p));
$stmt->BindValue(":host",$host);
@@ -300,8 +289,7 @@ $stmt->BindValue(":uid",posix_getuid());
$stmt->BindValue(":zpath",$zpath);
$stmt->BindValue(":bpath",$bpath);
$stmt->BindValue(":type",$type);
$stmt->BindValue(":details",$dstring);
$stmt->BindValue(":qlmanage",$qlmanage);
$stmt->BindValue(":qlmanage",serialize($qlmanage));
$stmt->BindValue(":sysvers",$sysvers);
$stmt->BindValue(":disks",$disks);
$stmt->BindValue(":diskutil",$diskutil);
@@ -587,7 +575,7 @@ if ($p['thumbs']) {
file_put_contents($batchfile,implode("\n", $line));
echo ProgressBar::finish($wopt_clear);
echo ProgressBar::start($passed_file,"Running thumb batch (".stepString().")");
echo ProgressBar::start($passed_file,"Running thumb batch (".stepString().")");
if ($wopt_parallel) {
passthru($bin_parallel." < ".$batchfile);
} else {