Example #1
0
<?php

/**
 *
 * @author G. Giunta
 * @copyright (C) G. Giunta 2008-2016
 * @license Licensed under GNU General Public License v2.0. See file license.txt
 *
 * @todo add more details, such as dates of first/last files
 * @todo add possibility to zoom in to file list going to cachesearch view
 * @todo add support for db-clustered configs - hard currently, since there is no recursive search in api...
 * @todo in ezdfs mode allow user to only show clustered data
 */
$cacheFilesList = array();
$cacheList = eZCache::fetchList();
foreach ($cacheList as $cacheItem) {
    if ($cacheItem['path'] != false && $cacheItem['enabled']) {
        $cacheFilesList[$cacheItem['name']] = array('path' => $cacheItem['path']);
        // take care: this is hardcoded from knowledge of cache structure...
        if ($cacheItem['path'] == 'var/cache/ini') {
            $cachedir = eZSys::siteDir() . '/' . $cacheItem['path'];
        } else {
            $cachedir = eZSys::cacheDirectory() . '/' . $cacheItem['path'];
        }
        $count = sysInfoTools::countFilesInDir($cachedir);
        $cacheFilesList[$cacheItem['name']]['count'] = $count;
        if ($count) {
            $cacheFilesList[$cacheItem['name']]['size'] = number_format(sysInfoTools::countFilesSizeInDir($cachedir));
        } else {
            $cacheFilesList[$cacheItem['name']]['size'] = "";
        }
Example #2
0
 /**
  * Finds all cache item which has ID equal to one of the IDs in $idList.
  * You can also submit a single id to $idList.
  *
  * @param array $idList The cache ID list
  * @param bool|array $cacheList The list of caches, default false
  */
 static function clearByID($idList, $cacheList = false)
 {
     if (!$cacheList) {
         $cacheList = eZCache::fetchList();
     }
     $cacheItems = array();
     if (!is_array($idList)) {
         $idList = array($idList);
     }
     foreach ($cacheList as $cacheItem) {
         if (in_array($cacheItem['id'], $idList)) {
             $cacheItems[] = $cacheItem;
         }
     }
     foreach ($cacheItems as $cacheItem) {
         eZCache::clearItem($cacheItem);
     }
     return true;
 }
Example #3
0
 function getMIBTree()
 {
     // build list of oids corresponding to order status
     $db = self::eZDBinstance();
     $orderStatusIdoids = array();
     $orderStatusNameoids = array();
     $orderStatusCountoids = array();
     $orderStatusArchiveCountoids = array();
     if ($db) {
         $status = $db->arrayQuery('select status_id, name from ezorder_status where is_active=1 order by id');
         $db->close();
         if (is_array($status)) {
             $i = 1;
             foreach ($status as $line) {
                 self::$orderstatuslist = array_merge(self::$orderstatuslist, array("2.1.5.1.1.1.{$i}" => $line['status_id'], "2.1.5.1.1.2.{$i}" => $line['name'], "2.1.5.1.1.3.{$i}" => $line['status_id'], "2.1.5.1.1.4.{$i}" => $line['status_id']));
                 $orderStatusIdoids[$i] = array('name' => 'orderStatusId' . $i, 'syntax' => 'INTEGER');
                 $orderStatusNameoids[$i] = array('name' => 'orderStatusname' . $i, 'syntax' => 'DisplayString');
                 $orderStatusCountoids[$i] = array('name' => 'orderStatusCount' . $i, 'syntax' => 'INTEGER');
                 $orderStatusArchiveCountoids[$i] = array('name' => 'orderStatusArchive' . $i, 'syntax' => 'INTEGER');
                 $i++;
             }
         }
         //var_dump($orderStatusArchiveCountoids);
         //die();
     } else {
         // what to do in this case? db is down - maybe we should raise an exception
         // instead of producing a shortened oid list...
     }
     // build list of oids corresponding to caches and store for later their config
     $i = 1;
     $cacheoids = array();
     foreach (eZCache::fetchList() as $cacheItem) {
         if ($cacheItem['path'] != false) {
             $id = $cacheItem['id'];
             self::$cachelist = array_merge(self::$cachelist, array("2.2.{$i}.1" => $id, "2.2.{$i}.2" => $id, "2.2.{$i}.3" => $id, "2.2.{$i}.4" => $id));
             $cachename = 'cache' . ucfirst(eZSNMPd::asncleanup($id));
             $cacheoids[$i] = array('name' => $cachename, 'children' => array(1 => array('name' => "{$cachename}Name", 'syntax' => 'DisplayString', 'description' => 'The name of this cache.'), 2 => array('name' => "{$cachename}Status", 'syntax' => 'INTEGER', 'description' => 'Cache status: 1 for enabled, 0 for disabled.'), 3 => array('name' => "{$cachename}Count", 'syntax' => 'INTEGER', 'description' => 'Number of files in the cache (-1 if current cluster mode not supported).'), 4 => array('name' => "{$cachename}Size", 'syntax' => 'INTEGER', 'description' => 'Sum of size of all files in the cache (-1 if current cluster mode not supported).')));
             $i++;
         }
     }
     // build list of oids corresponding to storage dirs
     /// @todo this way of finding storage dir is lame, as it depends on them having been created
     ///       it will also not work in cluster mode, as there will be no dirs on the fs...
     $storagedir = eZSys::storageDirectory();
     $files = @scandir($storagedir);
     $i = 1;
     $storagediroids = array();
     foreach ($files as $file) {
         if ($file != '.' && $file != '..' && is_dir($storagedir . '/' . $file)) {
             self::$storagedirlist = array_merge(self::$storagedirlist, array("2.3.{$i}.1" => $storagedir . '/' . $file, "2.3.{$i}.2" => $storagedir . '/' . $file, "2.3.{$i}.3" => $storagedir . '/' . $file));
             $storagedirname = 'storage' . ucfirst(eZSNMPd::asncleanup($file));
             $storagediroids[$i] = array('name' => $storagedirname, 'children' => array(1 => array('name' => "{$storagedirname}Path", 'syntax' => 'DisplayString', 'description' => 'The path of this storage dir.'), 2 => array('name' => "{$storagedirname}Count", 'syntax' => 'INTEGER', 'description' => 'Number of files in the dir (-1 if current cluster mode not supported).'), 3 => array('name' => "{$storagedirname}Size", 'syntax' => 'INTEGER', 'description' => 'Sum of size of all files in the dir (-1 if current cluster mode not supported).')));
             $i++;
         }
     }
     return array('name' => 'eZPublish', 'children' => array(2 => array('name' => 'status', 'children' => array(1 => array('name' => 'database', 'children' => array(1 => array('name' => 'dbstatus', 'syntax' => 'INTEGER', 'description' => 'Availability of the database.'), 2 => array('name' => 'content', 'children' => array(1 => array('name' => 'contentObjects', 'syntax' => 'INTEGER', 'description' => 'The number of content objects.'), 2 => array('name' => 'contentObjectAttributes', 'syntax' => 'INTEGER', 'description' => 'The number of content object attributes.'), 3 => array('name' => 'contentObjectNodes', 'syntax' => 'INTEGER', 'description' => 'The number of content nodes.'), 4 => array('name' => 'contentObjectRelations', 'syntax' => 'INTEGER', 'description' => 'The number of content object relations.'), 5 => array('name' => 'contentObjectDrafts', 'syntax' => 'INTEGER', 'description' => 'The number of content objects in DRAFT state.'), 6 => array('name' => 'contentObjectClasses', 'syntax' => 'INTEGER', 'description' => 'The number of content object classes.'), 7 => array('name' => 'contentObjectInfoCollections', 'syntax' => 'INTEGER', 'description' => 'The number of information collections.'), 8 => array('name' => 'contentObjectsPendingIndexation', 'syntax' => 'INTEGER', 'description' => 'The number of objects pending a search-engine indexation.'), 9 => array('name' => 'pendingNotificationEvents', 'syntax' => 'INTEGER', 'description' => 'The number of pending notification events.'))), 3 => array('name' => 'users', 'children' => array(1 => array('name' => 'registeredusers', 'syntax' => 'INTEGER', 'description' => 'The number of existing user accounts.'))), 4 => array('name' => 'sessions', 'children' => array(1 => array('name' => 'allSessions', 'syntax' => 'INTEGER', 'description' => 'The number of active sessions.'), 2 => array('name' => 'anonSessions', 'syntax' => 'INTEGER', 'description' => 'The number of active anonymous users sessions.'), 3 => array('name' => 'registeredSessions', 'syntax' => 'INTEGER', 'description' => 'The number of active registered users sessions.'))), 5 => array('name' => 'shop', 'children' => array(1 => array('name' => 'orderStatusTable', 'access' => eZMIBTree::access_not_accessible, 'syntax' => 'SEQUENCE OF OrderStatusEntry', 'description' => 'A table containing the number of orders per order state.', 'children' => array(0 => array('name' => 'OrderStatusEntry', 'syntax' => 'SEQUENCE', 'items' => array(1 => array('name' => 'orderStatusId', 'syntax' => 'INTEGER'), 2 => array('name' => 'orderStatusName', 'syntax' => 'DisplayString'), 3 => array('name' => 'orderStatusCount', 'syntax' => 'INTEGER'), 4 => array('name' => 'orderStatusArchiveCount', 'syntax' => 'INTEGER'))), 1 => array('name' => 'orderStatusEntry', 'access' => eZMIBTree::access_not_accessible, 'syntax' => 'OrderStatusEntry', 'description' => 'A table row describing the set of orders in status N.', 'index' => 'orderStatusId', 'children' => array(1 => array('name' => 'orderStatusId', 'syntax' => 'INTEGER (1..99)', 'description' => 'ID of this order status.', 'nochildreninmib' => true, 'children' => $orderStatusIdoids), 2 => array('name' => 'orderStatusName', 'syntax' => 'DisplayString', 'description' => 'The name of this order status.', 'nochildreninmib' => true, 'children' => $orderStatusNameoids), 3 => array('name' => 'orderStatusCount', 'syntax' => 'INTEGER', 'description' => 'Number of active orders in this status.', 'nochildreninmib' => true, 'children' => $orderStatusCountoids), 4 => array('name' => 'orderStatusArchiveCount', 'syntax' => 'INTEGER', 'description' => 'Number of archived orders in this status.', 'nochildreninmib' => true, 'children' => $orderStatusArchiveCountoids))))))), 6 => array('name' => 'asyncpublishing', 'children' => array(1 => array('name' => 'AsyncPublishingWorkingCount', 'syntax' => 'INTEGER', 'description' => 'Number of Asynchronous Publication events in Working status'), 2 => array('name' => 'AsyncPublishingFinishedCount', 'syntax' => 'INTEGER', 'description' => 'Number of Asynchronous Publication events in Finished status'), 3 => array('name' => 'AsyncPublishingPendingCount', 'syntax' => 'INTEGER', 'description' => 'Number of Asynchronous Publication events in Pending status'), 4 => array('name' => 'AsyncPublishingDeferredCount', 'syntax' => 'INTEGER', 'description' => 'Number of Asynchronous Publication events in Deferred status'), 5 => array('name' => 'AsyncPublishingUnknownCount', 'syntax' => 'INTEGER', 'description' => 'Number of Asynchronous Publication events in Unknown status'))))), 2 => array('name' => 'cache', 'children' => $cacheoids), 3 => array('name' => 'storage', 'children' => $storagediroids), 4 => array('name' => 'external', 'children' => array(1 => array('name' => 'ldap', 'syntax' => 'INTEGER', 'description' => 'Connectivity to LDAP server (-1 if not configured).'), 2 => array('name' => 'web', 'syntax' => 'INTEGER', 'description' => 'Connectivity to the web. (probes a series of webservers defined in snmpd.ini, returns -1 if not configured).'), 3 => array('name' => 'email', 'syntax' => 'INTEGER', 'description' => 'Connectivity to mail server (NB: will send a test mail when probed to a recipient defined in snmpd.ini, returns -1 if not configured).'))), 5 => array('name' => 'cluster', 'children' => array(1 => array('name' => 'clusterdbstatus', 'syntax' => 'INTEGER', 'description' => 'Availability of the cluster database (-1 for NA).')))))));
 }