-
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 4376 - updates to disable users
- Loading branch information
Showing
3 changed files
with
62 additions
and
18 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
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,17 @@ | ||
<?php | ||
require_once 'scheduled-task-commands/globals.php'; | ||
require_once APP_PATH . '/Leaf/Db.php'; | ||
require_once APP_PATH . '/Leaf/VAMCActiveDirectory.php'; | ||
|
||
$startTime = microtime(true); | ||
|
||
|
||
$national_db = new App\Leaf\Db(DIRECTORY_HOST, DIRECTORY_USER, DIRECTORY_PASS, 'national_orgchart'); | ||
$dir = new App\Leaf\VAMCActiveDirectory($national_db); | ||
|
||
$dir->disableNationalOrgchartEmployees(); | ||
|
||
$endTime = microtime(true); | ||
$totalTime = round(($endTime - $startTime)/60, 2); | ||
|
||
error_log(print_r($file . " took " . $totalTime . " minutes to complete.", true), 3 , '/var/www/php-logs/ad_processing.log'); |
24 changes: 24 additions & 0 deletions
24
scripts/scheduled-task-commands/updateNationalOrgchartEmployees.php
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,24 @@ | ||
<?php | ||
require_once 'globals.php'; | ||
require_once APP_PATH . '/Leaf/Db.php'; | ||
|
||
$db = new App\Leaf\Db(DIRECTORY_HOST, DIRECTORY_USER, DIRECTORY_PASS, 'national_orgchart'); | ||
|
||
$sql = 'SELECT `cacheID`, LEFT(`data`, 5) AS `data` | ||
FROM `cache` | ||
WHERE LEFT(`data`, 3) = "DN,"'; | ||
|
||
$VISNS = $db->query($sql); | ||
|
||
function updateEmps($VISNS) { | ||
foreach ($VISNS as $visn) { | ||
if (str_starts_with($visn['data'], 'DN,')) { | ||
exec("php /var/www/scripts/updateNationalOrgchart.php {$visn['cacheID']} > /dev/null 2>/dev/null &"); | ||
echo "Deploying to: {$visn['cacheID']}\r\n"; | ||
} | ||
} | ||
|
||
exec ("php disableNationalOrgchartEmployees.php > /dev/null 2>/dev/null &"); | ||
} | ||
|
||
updateEmps($VISNS); |