Changeset 186
- Timestamp:
- 01/07/07 21:01:14 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
wifidog/wifidog-auth/wifidog/classes/Network.php
r183 r186 1247 1247 } 1248 1248 1249 /** 1250 * Find out how many deployed nodes are online in this networks's database 1251 * 1252 * @return int Number of deployed nodes which are online 1253 * 1254 * @access public 1255 */ 1256 public function getNumOnlineNodes() { 1249 public function getNumDeployedNodes2() { 1257 1250 // Define globals 1258 1251 global $db; … … 1265 1258 1266 1259 // Create new cache objects (valid for 5 minutes) 1260 $_cache = new Cache('network_'.$this->id.'_num_deployed_nodes', $this->id, 300); 1261 1262 // Check if caching has been enabled. 1263 if ($_cache->isCachingEnabled) { 1264 $_cachedData = $_cache->getCachedData(); 1265 1266 if ($_cachedData) { 1267 // Return cached data. 1268 $_useCache = true; 1269 $_retval = $_cachedData; 1270 } 1271 } 1272 1273 if (!$_useCache) { 1274 // Get number of deployed nodes 1275 $_network_id = $db->escapeString($this->id); 1276 if(Network :: isDefaultNetwork()) { 1277 $db->execSqlUniqueRes("SELECT COUNT(node_id) FROM nodes WHERE node_deployment_status = 'DEPLOYED' OR node_deployment_status = 'NON_WIFIDOG_NODE'", $_row, false); 1278 } 1279 else $db->execSqlUniqueRes("SELECT COUNT(node_id) FROM nodes WHERE network_id = '$_network_id' AND (node_deployment_status = 'DEPLOYED' OR node_deployment_status = 'NON_WIFIDOG_NODE')", $_row, false); 1280 1281 // String has been found 1282 $_retval = $_row['count']; 1283 1284 // Check if caching has been enabled. 1285 if ($_cache->isCachingEnabled) { 1286 // Save data into cache, because it wasn't saved into cache before. 1287 $_cache->saveCachedData($_retval); 1288 } 1289 } 1290 1291 return $_retval; 1292 } 1293 1294 /** 1295 * Find out how many deployed nodes are online in this networks's database 1296 * 1297 * @return int Number of deployed nodes which are online 1298 * 1299 * @access public 1300 */ 1301 public function getNumOnlineNodes() { 1302 // Define globals 1303 global $db; 1304 1305 // Init values 1306 $_retval = 0; 1307 $_row = null; 1308 $_useCache = false; 1309 $_cachedData = null; 1310 1311 // Create new cache objects (valid for 5 minutes) 1267 1312 $_cache = new Cache('network_'.$this->id.'_num_online_nodes', $this->id, 300); 1268 1313 … … 1283 1328 // Passage à 30 minutes 1284 1329 $db->execSqlUniqueRes("SELECT COUNT(node_id) FROM nodes WHERE network_id = '$_network_id' AND (node_deployment_status = 'DEPLOYED' OR node_deployment_status = 'NON_WIFIDOG_NODE') AND ((NOW()-last_heartbeat_timestamp) < interval '30 minutes')", $_row, false); 1330 1331 // String has been found 1332 $_retval = $_row['count']; 1333 1334 // Check if caching has been enabled. 1335 if ($_cache->isCachingEnabled) { 1336 // Save data into cache, because it wasn't saved into cache before. 1337 $_cache->saveCachedData($_retval); 1338 } 1339 } 1340 1341 return $_retval; 1342 } 1343 1344 public function getNumOnlineNodes2() { 1345 // Define globals 1346 global $db; 1347 1348 // Init values 1349 $_retval = 0; 1350 $_row = null; 1351 $_useCache = false; 1352 $_cachedData = null; 1353 1354 // Create new cache objects (valid for 5 minutes) 1355 $_cache = new Cache('network_'.$this->id.'_num_online_nodes', $this->id, 300); 1356 1357 // Check if caching has been enabled. 1358 if ($_cache->isCachingEnabled) { 1359 $_cachedData = $_cache->getCachedData(); 1360 1361 if ($_cachedData) { 1362 // Return cached data. 1363 $_useCache = true; 1364 $_retval = $_cachedData; 1365 } 1366 } 1367 1368 if (!$_useCache) { 1369 // Get number of online nodes 1370 $_network_id = $db->escapeString($this->id); 1371 if (Network :: isDefaultNetwork()) 1372 { 1373 // Passage à 30 minutes 1374 $db->execSqlUniqueRes("SELECT COUNT(node_id) FROM nodes WHERE (node_deployment_status = 'DEPLOYED' OR node_deployment_status = 'NON_WIFIDOG_NODE') AND ((NOW()-last_heartbeat_timestamp) < interval '30 minutes')", $_row, false); 1375 } else $db->execSqlUniqueRes("SELECT COUNT(node_id) FROM nodes WHERE network_id = '$_network_id' AND (node_deployment_status = 'DEPLOYED' OR node_deployment_status = 'NON_WIFIDOG_NODE') AND ((NOW()-last_heartbeat_timestamp) < interval '30 minutes')", $_row, false); 1285 1376 1286 1377 // String has been found … … 1756 1847 1757 1848 // Set networks node information 1758 $smarty->assign('networkNumDeployedNodes', $net ? $net->getNumDeployedNodes () : 0);1759 $smarty->assign('networkNumOnlineNodes', $net ? $net->getNumOnlineNodes () : 0);1849 $smarty->assign('networkNumDeployedNodes', $net ? $net->getNumDeployedNodes2() : 0); 1850 $smarty->assign('networkNumOnlineNodes', $net ? $net->getNumOnlineNodes2() : 0); 1760 1851 } 1761 1852 } wifidog/wifidog-auth/wifidog/locale/fr/LC_MESSAGES/messages.po
r144 r186 1370 1370 #: ../classes/StatisticReport/UserReport.php:137 smarty.txt:216 smarty.txt:238 1371 1371 #: smarty.txt:241 smarty.txt:224 smarty.txt:222 smarty.txt:188 1372 msgid "network" 1373 msgstr "réseau" 1374 1375 #: 1372 1376 msgid "Network" 1373 1377 msgstr "Réseau" … … 2855 2859 #: smarty.txt:181 smarty.txt:215 smarty.txt:29 smarty.txt:179 smarty.txt:213 2856 2860 #: smarty.txt:12 smarty.txt:192 2857 msgid "network"2858 msgstr "réseau"2859 2861 2860 2862 msgid "new users" … … 5324 5326 msgstr "réseau possÚde" 5325 5327 5328 #: 5329 msgid "currently has" 5330 msgstr "possÚde actuellement" 5331 5326 5332 #: smarty.txt:95 smarty.txt:117 smarty.txt:120 smarty.txt:94 smarty.txt:97 5327 5333 #: smarty.txt:128 … … 5336 5342 #: smarty.txt:97 smarty.txt:119 smarty.txt:122 smarty.txt:96 smarty.txt:99 5337 5343 #: smarty.txt:130 5338 msgid "users," 5339 msgstr "usagers," 5344 msgid "valid users," 5345 msgstr "usagers valides," 5346 5347 msgid "valid user," 5348 msgstr "usager valide," 5349 5340 5350 5341 5351 #: smarty.txt:98 smarty.txt:120 smarty.txt:123 smarty.txt:97 smarty.txt:100 … … 5357 5367 #: smarty.txt:134 5358 5368 msgid "It currently has" 5359 msgstr "Il a en ce moment"5369 msgstr "Il y a en ce moment" 5360 5370 5361 5371 #: smarty.txt:102 smarty.txt:124 smarty.txt:127 smarty.txt:101 smarty.txt:104 … … 5373 5383 msgid "hotspots," 5374 5384 msgstr "points d'accÚs," 5385 5386 msgid "deployed hotspot," 5387 msgstr "point d'accÚs déployé," 5388 5389 msgid "deployed hotspots," 5390 msgstr "points d'accÚs déployés," 5375 5391 5376 5392 #: smarty.txt:105 smarty.txt:127 smarty.txt:130 smarty.txt:104 smarty.txt:107 wifidog/wifidog-auth/wifidog/templates/sites/index.tpl
r185 r186 70 70 *} 71 71 <p> 72 {"The"|_} { $networkName}73 {" network currently has"|_} {$networkNumValidUsers} {"valid"|_}72 {"The"|_} {"network"|_} {$networkName} 73 {"currently has"|_} {$networkNumValidUsers} 74 74 {if $networkNumValidUsers == 1} 75 {" user,"|_}75 {"valid user,"|_} 76 76 {else} 77 {" users,"|_}77 {"valid users,"|_} 78 78 {/if} 79 79 {$networkNumOnlineUsers} … … 85 85 {"currently online"|_}. 86 86 <br> 87 {" It currently has"|_} {$networkNumDeployedNodes} {"deployed"|_}87 {"The network currently has"|_} {$networkNumDeployedNodes} 88 88 {if $networkNumDeployedNodes == 1} 89 {" hotspot,"|_}89 {"deployed hotspot,"|_} 90 90 {else} 91 {" hotspots,"|_}91 {"deployed hotspots,"|_} 92 92 {/if} 93 93 {$networkNumOnlineNodes}
