/** * Do a full on search on the filesystem for WordPress installs */ public function cmd_search($savesites = true) { global $wp; logger("Looking for WP installs with: `" . $this->findcmd . "`\n"); $sarray = array(); $alldirs = cmd_runner($this->findcmd, true); foreach ($alldirs as $dir) { if (strpos($dir, 'total-cache')) { continue; } if ($this->ignoredirs && in_array($dir, $this->ignoredirs)) { continue; } $wpdir = dirname($dir); if (strlen($wpdir) < 1) { continue; } $site = new wp_site($wpdir); $this->wpsites[] = $site; $site->pushd(); // Change to the site directory $site->get_dbinfo(); // Get the site db info. $site->get_siteurl(); // Now get information about the backups $site->get_backup_summary(); $site->printer(); if ($savesites) { $site->mongo_save(); } } return $sarray; }
/** * run the command provided */ function do_command($wpclicmd, $username = null) { if (null === $this->_wpcli) { $this->__init(); } $cmd = ''; if ($username) { $cmd = "sudo -u " . $username . " -- "; } $cmd .= $this->_wpcli . " " . $wpclicmd; if ($this->verbose) { logger("Running: " . $cmd . "\n"); } $res = trim(cmd_runner($cmd)); return $res; }
function theme_list() { $verbose = false; $updates = 'up to date'; if (!$this->pushd()) { return; } $cmd = 'wp theme list --format=json'; $json = cmd_runner($cmd); $plugins = json_decode($json); foreach ($plugins as $p) { if ($p->update == 'available') { $updates = "updates available"; logger(sprintf("%40s %9s %20s %12s\n", $p->name, $p->status, $p->update, $p->version)); } } if (!$this->popd()) { return; } }