Prechádzať zdrojové kódy

fixed names and debug in Notify - Cron

Piotr Labudda 10 rokov pred
rodič
commit
694f7066ca

+ 3 - 3
SE/bash_sync_perms.php

@@ -456,13 +456,13 @@ class SyncPerms {
 	public static function sendNofity() {
 		Lib::loadClass('Router');
 		$keyToken = 'bach_sync_perms';
-		$token = Router::getRoute('Cron')->generateCliAuthToken($keyToken, 'test', 300 * 10);
+		$token = Router::getRoute('Cron')->generateCliAuthToken($keyToken, 'sendNofity', 300 * 10);
 		echo "DBG: token = '{$token}'" . "\n";
 
 		$baseUrl = "https://{$_SERVER['SERVER_NAME']}/SE";
 		if ('biuro.biall-net.pl' == $_SERVER['SERVER_NAME']) $baseUrl = "https://{$_SERVER['SERVER_NAME']}/SE/version-git";
 
-		//file_get_contents("https://{$baseUrl}/index.php?_route=Cron&_key={$keyToken}&_token={$token}&_task=test");
+		//file_get_contents("https://{$baseUrl}/index.php?_route=Cron&_key={$keyToken}&_token={$token}&_task=sendNofity");
 
 		function runUrlTask($url) {
 		  $ch = curl_init();
@@ -475,7 +475,7 @@ class SyncPerms {
 		  curl_close($ch);
 		  return $return;
 		}
-		$string = runUrlTask("{$baseUrl}/index.php?_route=Cron&_key={$keyToken}&_token={$token}&_task=test");
+		$string = runUrlTask("{$baseUrl}/index.php?_route=Cron&_key={$keyToken}&_token={$token}&_task=sendNofity");
 		echo "DBG: string -----------------------\n{$string}\nEOF string---------------------------------\n";
 	}
 

+ 3 - 4
SE/se-lib/Route/Cron-test.php

@@ -10,7 +10,7 @@ if (isset($_SERVER["argv"][1])) {
 
 Lib::loadClass('Router');
 $keyToken = 'bach_sync_perms';
-$token = Router::getRoute('Cron')->generateCliAuthToken($keyToken, 'test', 300 * 10);
+$token = Router::getRoute('Cron')->generateCliAuthToken($keyToken, 'sendNofity', 300 * 10);
 echo "DBG: token = '{$token}'" . "\n";
 
 //echo "DBG: IP(biuro.biall-net.pl) = '" . gethostbyname('biuro.biall-net.pl') . "'" . "\n";
@@ -20,7 +20,7 @@ $baseUrl = "https://{$_SERVER['SERVER_NAME']}/SE";
 if ('biuro.biall-net.pl' == $_SERVER['SERVER_NAME']) $baseUrl = "https://{$_SERVER['SERVER_NAME']}/SE/version-git";
 //if ('biuro.biall-net.pl' == $_SERVER['SERVER_NAME']) $baseUrl = "https://{$_SERVER['SERVER_NAME']}/dev-pl/se-master";
 
-//file_get_contents("https://{$baseUrl}/index.php?_route=Cron&_key={$keyToken}&_token={$token}&_task=test");
+//file_get_contents("https://{$baseUrl}/index.php?_route=Cron&_key={$keyToken}&_token={$token}&_task=sendNofity");
 
 function runUrlTask($url) {
   $ch = curl_init();
@@ -33,8 +33,7 @@ function runUrlTask($url) {
   curl_close($ch);
   return $return;
 }
-//$string = runUrlTask("https://{$baseUrl}/index.php?_route=Cron&_key={$keyToken}&_token={$token}&_task=test");
-$string = runUrlTask("{$baseUrl}/index.php?_route=Cron&_key={$keyToken}&_token={$token}&_task=test");
+$string = runUrlTask("{$baseUrl}/index.php?_route=Cron&_key={$keyToken}&_token={$token}&_task=sendNofity");
 echo "DBG: string -----------------------\n{$string}\nEOF string---------------------------------\n";
 
 die("\n\n.EOF\n");

+ 2 - 2
SE/se-lib/Route/Cron.php

@@ -94,7 +94,7 @@ class Route_Cron extends RouteBase {
 		SE_Layout::dol();
 	}
 
-	public function testAction() {
+	public function sendNofityAction() {
 		$notify = Router::getRoute('Notify');
 		$todoReminders = array();
 
@@ -110,7 +110,7 @@ class Route_Cron extends RouteBase {
 		?>
 <div class="container">
 	<h1>Cron</h1>
-	<?php DBG::_(true, true, 'todoReminders', $todoReminders, __CLASS__, __FUNCTION__, __LINE__); ?>
+	<?php DBG::_('DBG_CRON', '>0', 'todoReminders', $todoReminders, __CLASS__, __FUNCTION__, __LINE__); ?>
 </div>
 		<?php
 

+ 3 - 3
SE/se-lib/Route/Notify.php

@@ -739,7 +739,7 @@ function refreshPreview() {
 		$reminders = array();
 		$timeToday = mktime(0, 0, 0, date('n'), date('j'), date('Y'));
 		//$timeTomorrow = mktime(0, 0, 0, date('n'), date('j') + 1, date('Y'));
-		DBG::_(true, true, "rawReminders (today:{$timeToday}. tomorrow:{$timeTomorrow})", $rawReminders, __CLASS__, __FUNCTION__, __LINE__);
+		DBG::_('DBG_NTF', '>1', "rawReminders (today:{$timeToday})", $rawReminders, __CLASS__, __FUNCTION__, __LINE__);
 		foreach ($rawReminders as $row) {
 			$user = $row['who'];
 			$when = $row['when'];
@@ -747,13 +747,13 @@ function refreshPreview() {
 			$last_exec_time = $row['last_exec_time'];
 			if ('once_a_day' == $when) {
 				if ($last_exec_time >= $timeToday) {
-					DBG::_('DBG_CRON', '>1', "skip {$last_exec_time} for {$what} at {$when}", $row, __CLASS__, __FUNCTION__, __LINE__);
+					DBG::_('DBG_NTF', '>1', "skip {$last_exec_time} for {$what} at {$when}", $row, __CLASS__, __FUNCTION__, __LINE__);
 					continue;
 				} else {
 					//DBG::_(true, true, "TODO: else {$last_exec_time} >= {$timeToday}", $row, __CLASS__, __FUNCTION__, __LINE__);
 				}
 			} else {
-				DBG::_('DBG_CRON', '>0', "TODO: unimplemented when = '{$when}'", $row, __CLASS__, __FUNCTION__, __LINE__);
+				DBG::_('DBG_NTF', '>0', "TODO: unimplemented when = '{$when}'", $row, __CLASS__, __FUNCTION__, __LINE__);
 				continue;
 			}
 			$last_date = ($last_exec_time)? date("Y-m-d H:i:s", $last_exec_time) : null;