-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Leaf 4486 - update to update scripts
- Loading branch information
Showing
2 changed files
with
62 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
require_once 'globals.php'; | ||
require_once APP_PATH . '/Leaf/Db.php'; | ||
|
||
$dir = '/var/www/html'; | ||
|
||
$startTime = microtime(true); | ||
|
||
$db = new App\Leaf\Db(DIRECTORY_HOST, DIRECTORY_USER, DIRECTORY_PASS, 'national_leaf_launchpad'); | ||
|
||
$vars = array(':orgcharts' => '/NATIONAL/101/orgchart'); | ||
|
||
$sql = 'SELECT `site_path` | ||
FROM `sites` | ||
WHERE `site_type` = "orgchart" | ||
AND `site_path` IN (:orgcharts) | ||
ORDER BY `site_path`'; | ||
|
||
$paths = $db->prepared_query($sql, $vars); | ||
|
||
passthru("cat /dev/null > /var/www/tmp/refreshOrgcharts.txt"); | ||
|
||
echo "Refresh Orgcharts Started ...\r\n"; | ||
|
||
$forgcharts = fopen('/var/www/tmp/refreshOrgcharts.txt', 'w'); | ||
|
||
foreach ($paths as $path) { | ||
$site = rtrim($path['site_path'], '/'); | ||
fwrite($forgcharts, "{$dir}{$site}/\r\n"); | ||
} | ||
|
||
fclose($forgcharts); | ||
|
||
echo "Refreshing Orgcharts\r\n"; | ||
passthru("cat /var/www/tmp/refreshOrgcharts.txt | parallel -j 100 -d '\r\n' php {}scripts/refreshOrgchartEmployees.php"); | ||
|
||
$endTime = microtime(true); | ||
$timeInMinutes = round(($endTime - $startTime) / 60, 2); | ||
echo "Refresh took {$timeInMinutes} minutes and ended at "; | ||
echo date('Y-m-d g:i:s a'). "\r\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters