]> _ Git - cubeextranet.git/commitdiff
wip #6219 @2
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 25 Aug 2023 13:41:31 +0000 (13:41 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 25 Aug 2023 13:41:31 +0000 (13:41 +0000)
.docker/docker-compose.yml
.docker/images/php/startup
bin/fixrights
inc/ws/Controlleur/class.ws.maintenance.php
inc/ws/Controlleur/class.ws.stats.php
inc/ws/DAO/class.ws.dao.book.php

index 5f5ca73c243edf3bb8f7b8f8afeb9d922193a86b..7d20cca136fd5b114f2baa3d5c9409455deca133 100644 (file)
@@ -27,7 +27,6 @@ services:
       - '/data/extranet/www/fluidbook/cache/nwbuild:/usr/lib/node_modules/nw-builder/cache'\r
       - '/home/toolbox/www:/home/toolbox/www'\r
       - '/data/toolbox/:/data/toolbox/'\r
-      - '/home/stats/www:/home/stats/www'\r
       - '/home/wesco:/home/wesco'\r
       # Config\r
       - '/home/extranet/.docker/config/httpd/httpd.conf:/usr/local/apache2/conf/httpd.conf'\r
@@ -67,7 +66,6 @@ services:
       - '/data/extranet/www/fluidbook/cache/nwbuild:/usr/lib/node_modules/nw-builder/cache'\r
       - '/home/toolbox/www:/home/toolbox/www'\r
       - '/data/toolbox/:/data/toolbox/'\r
-      - '/home/stats/www:/home/stats/www'\r
       - '/home/wesco:/home/wesco'\r
       # Config\r
       - '/home/extranet/.docker/config/httpd/httpd-nb.conf:/usr/local/apache2/conf/httpd.conf'\r
@@ -114,7 +112,6 @@ services:
       # PHP\r
       - '/home/extranet/.docker/config/php.ini:/etc/php/7.2/fpm/conf.d/99-overrides.ini'\r
       - '/home/extranet/sessions/:/var/lib/php/sessions/'\r
-      - '/usr/share/GeoIP/GeoIP.dat:/home/stats/www/GeoIP.dat'\r
       # Crontab\r
       - '/home/extranet/.docker/config/cron/crontab:/etc/crontab'\r
       # Passwords\r
@@ -143,7 +140,6 @@ services:
       - '/data/extranet/www/fluidbook/cache/nwbuild:/usr/lib/node_modules/nw-builder/cache'\r
       - '/home/toolbox/www:/home/toolbox/www'\r
       - '/data/toolbox/:/data/toolbox/'\r
-      - '/home/stats/www:/home/stats/www'\r
       - '/home/wesco:/home/wesco'\r
     tmpfs:\r
       #- '/tmp:mode=777,uid=1002,gid=33'\r
@@ -160,6 +156,9 @@ services:
       options:\r
         max-size: 10M\r
         max-file: 10\r
+    privileged: true\r
+    cap_add:\r
+      - SYS_ADMIN\r
 \r
   redis:\r
     container_name: extranet-redis\r
@@ -169,6 +168,7 @@ services:
     networks:\r
       - extranet\r
     restart: unless-stopped\r
+\r
 networks:\r
   extranet:\r
     external:\r
index c82563a121daf4ffb40c75474a611e02624455bd..18f547b6d90f611e84849dfe0add9659eb11fe95 100644 (file)
@@ -12,6 +12,14 @@ chmod 0644 /etc/crontab && crontab -u root /etc/crontab && /usr/sbin/service cro
 # Set user passwords
 chpasswd < /root/passwords
 
+# Mount stats
+mkdir -p /stats
+if mountpoint -q "/stats"; then
+    :
+else
+    sshfs -o reconnect,ServerAliveInterval=15,ServerAliveCountMax=3 -o uid=1002 -o gid=33 -o allow_other stats@dracula.cubedesigners.com:/docker/fluidbook-stats/www /stats
+fi
+
 # Launch monit
 chmod -R 700 /etc/monit;chown -R root:root /etc/monit;/usr/bin/monit
 sudo chmod -R 777 /etc/monit
index eaba77713edbcbf526c111a4554a57b62d664115..2750f8b212a195e8983af45642b47452ae758f25 100644 (file)
@@ -22,5 +22,4 @@ chmod -R 775 /data/extranet
 chmod -R 777 /home/extranet/share
 chmod -R 777 /home/extranet/www/fluidbook/packager/
 chmod -R 777 /home/toolbox/www/resources/fluidbookpublication/player
-chmod -R 777 /home/stats/www
 chmod -R 775 /data/extranet/www/fluidbook/books/working
index 736ddce841d7454c53e3eb14279b2f16df6ccad3..ab01c3bb155f7af31690d39ce8606cdbe11aba26 100644 (file)
@@ -1056,7 +1056,7 @@ class wsMaintenance
             return false;
         }
 
-        $cmd = "rm -rf /home/stats/www/objects/$book*;/home/stats/www/FWStats.sh /home/stats/www redobook=$book";
+        $cmd = "rm -rf /stats/objects/$book*;/stats/FWStats.sh /stats redobook=$book";
         `$cmd`;
     }
 
index b40ed146043dcf2ea30099495c883e4115f28ec8..60272c30be8ae3bfe466c7e00416328935a6b65e 100644 (file)
@@ -35,10 +35,12 @@ class wsStats
 \r
     protected static function _getXLSFile($bid, $annee = null, $mois = null)\r
     {\r
-        self::forceComputation($bid);\r
+        if (rand(1, 50) == 20) {\r
+            self::forceComputation($bid);\r
+        }\r
         $e = explode('_', $bid);\r
         $bid = $e[0];\r
-        $xname = '/home/stats/www/xls/' . $bid;\r
+        $xname = '/stats/xls/' . $bid;\r
         if (!is_null($annee)) {\r
             $xname .= '/' . $annee;\r
             if (!is_null($mois)) {\r
@@ -60,7 +62,9 @@ class wsStats
     {\r
         global $core;\r
 \r
-        self::forceComputation($bid);\r
+        if (rand(1, 50) == 20) {\r
+            self::forceComputation($bid);\r
+        }\r
 \r
         cubePHP::set_memory('12G');\r
 \r
@@ -572,7 +576,8 @@ class wsStats
         $title = '';\r
 \r
         $colsTitles = array(__('Période'), /*__('Lieux de visite'),*/\r
-            /*__('Visiteurs uniques'),*/ __('Visites'), __('Pages vues'));\r
+            /*__('Visiteurs uniques'),*/\r
+            __('Visites'), __('Pages vues'));\r
         if ($afriend) {\r
             $colsTitles[] = __('Liens envoyés');\r
         }\r
@@ -689,7 +694,8 @@ class wsStats
     public static function detailJour($book, $annee, $mois, $stats)\r
     {\r
         $colsTitles = array(__('Jour'), /*__('Lieux de visite'),*/\r
-            /*__('Visiteurs uniques'),*/ __('Visites'), __('Pages vues'), __('Liens cliqués'));\r
+            /*__('Visiteurs uniques'),*/\r
+            __('Visites'), __('Pages vues'), __('Liens cliqués'));\r
         $lines = array();\r
         $xlines = array();\r
 \r
@@ -923,7 +929,7 @@ class wsStats
         }\r
         $res = '<div class="graphStats"><div class="graph-note" style="top:' . $mhp . 'px;color:#514e49;">' . $maxpages . '</div>';\r
         $res .= '<div class="graph-note" style="top:' . $mhb . 'px;color:#f54d00;">' . $maxb . '</div>';\r
-       // $res .= '<div class="graph-note" style="top:' . $mhv . 'px;color:#c2d313;">' . $maxv . '</div>';\r
+        // $res .= '<div class="graph-note" style="top:' . $mhv . 'px;color:#c2d313;">' . $maxv . '</div>';\r
         $res .= '<div class="graph-container" style="background:url(' . $imgw . ')"></div>';\r
         $res .= '<table style="width:944px;max-width:944px;table-layout:fixed;" class="echelle"><tr>';\r
         foreach ($months as $m => $t) {\r
@@ -1038,7 +1044,7 @@ class wsStats
         $res .= '<table class="legende"><tr>';\r
         $res .= '<td style="width:12px;background:#514e49;height:12px;"></td><td style="width:10px;"></td><td>' . __('Pages vues') . '</td><td style="width:10px;"></td>';\r
         $res .= '<td style="width:12px;background:#f54d00;height:12px;"></td><td style="width:10px;"></td><td>' . __('Visites') . '</td><td style="width:10px;"></td>';\r
-       // $res .= '<td style="width:12px;background:#c2d313;height:12px;"></td><td style="width:10px;"></td><td>' . __('Visiteurs uniques') . '</td><td style="width:10px;"></td>';\r
+        // $res .= '<td style="width:12px;background:#c2d313;height:12px;"></td><td style="width:10px;"></td><td>' . __('Visiteurs uniques') . '</td><td style="width:10px;"></td>';\r
         $res .= '</tr></table></div>';\r
         return $res;\r
     }\r
@@ -1127,7 +1133,7 @@ class wsStats
         }\r
         $res = '<div class="graphStats"><div class="graph-note" style="top:' . $mhp . 'px;color:#514e49;">' . $maxpages . '</div>';\r
         $res .= '<div class="graph-note" style="top:' . $mhb . 'px;color:#f54d00;">' . $maxb . '</div>';\r
-      //  $res .= '<div class="graph-note" style="top:' . $mhv . 'px;color:#c2d313;">' . $maxv . '</div>';\r
+        //  $res .= '<div class="graph-note" style="top:' . $mhv . 'px;color:#c2d313;">' . $maxv . '</div>';\r
         $res .= '<div class="graph-container" style="background:url(' . $imgw . ')"></div>';\r
         $res .= '<table style="width:944px;max-width:944px;margin:0px;table-layout:fixed;" class="echelle"><tr>';\r
         foreach ($days as $d => $t) {\r
@@ -1139,20 +1145,13 @@ class wsStats
         $res .= '<table style="margin-top:10px;margin-bottom:10px;" class="legende"><tr>';\r
         $res .= '<td style="width:12px;background:#514e49;height:12px;"></td><td style="width:10px;"></td><td>' . __('Pages vues') . '</td><td style="width:10px;"></td>';\r
         $res .= '<td style="width:12px;background:#f54d00;height:12px;"></td><td style="width:10px;"></td><td>' . __('Visites') . '</td><td style="width:10px;"></td>';\r
-      //  $res .= '<td style="width:12px;background:#c2d313;height:12px;"></td><td style="width:10px;"></td><td>' . __('Visiteurs uniques') . '</td><td style="width:10px;"></td>';\r
+        //  $res .= '<td style="width:12px;background:#c2d313;height:12px;"></td><td style="width:10px;"></td><td>' . __('Visiteurs uniques') . '</td><td style="width:10px;"></td>';\r
         $res .= '</tr></table></div>';\r
         return $res;\r
     }\r
 \r
     public static function forceComputation($id)\r
     {\r
-        `/home/stats/www/FWStats.sh /home/stats/www onlybook=$id`;\r
-    }\r
-\r
-    /**\r
-     * @return \Cubist\Matomo\Reporting\r
-     */\r
-    public static function getMatomoAPI(){\r
-        return new \Cubist\Matomo\Reporting('https://v3.stats.fluidbook.com/','ebe362f44c01bda1ddedb75d7726ff78');\r
+        `/stats/FWStats.sh /stats onlybook=$id`;\r
     }\r
 }
\ No newline at end of file
index 1e8c03037714b55bc199a07c97e51e35d0e91f55..16abbe7b142037b892efef763c67d124a2329c67 100644 (file)
@@ -734,7 +734,7 @@ class wsDAOBook extends commonDAO
             }
         }
 
-        $file = '/home/stats/www/exclude/' . $book_id;
+        $file = '/stats/exclude/' . $book_id;
 
         if (count($ip)) {
             file_put_contents($file, implode(',', $ip));