Wikini

DiscussionsActionDAdministrationTaillesDesPages

PagePrincipale :: DerniersChangements :: DerniersCommentaires :: ParametresUtilisateur :: Vous êtes ec2-18-216-190-167.us-east-2.compute.amazonaws.com

Outil d'administration : voir la taille de toutes les pages de la base


Une nouvelle action {{AdminPagesSizes}} (tout le monde peut l'appeler sur n'importe quelle page - ce n'est pas une fonction sensible et il peut même être intéressant que les utilisateurs y aient accès). Sinon il faut (faudra|faudrait) mettre en place un blocage administrateur selon ce qui est en place chez vous ...
Possibilité de l'appeler par {{AdminPagesSizes owner="TITI"}} pour n'afficher que les pages appartenant à "TITI" (idem, dans l'optique de fournir aux utilisateurs ces infos).

Ajouter un fichier sous actions/adminpagessizes.php
<?php

  
// File : exportdb.php
  // Written by SergiO

  
$strings['fr']['S_EXPORT_LABEL'] = 'Export de la base de données';
  
$strings['fr']['S_DOWNLOAD'] = 'Downloader';
  
$strings['fr']['S_VIEW'] = 'Visualiser';
  
$strings['fr']['S_NO_ADMIN'] = "Vous n'&ecirc;tes pas autoris&eacute; &agrave; lire cette page";
  
$strings['fr']['S_COMMENTS'] = "est un commentaire";

  
// === Array set to current strings definitions with the current selected language
  //    (this array is to be used later like this : $lng_strings['STRING_LABEL'])
  
$lng_strings $strings['fr']; // strtolower($this->GetConfigValue('language'))

  // === Parameters of this action
  
$owner '';
  if (
is_array($vars))
  {
      foreach (
$vars as $param => $value)
      {
        
$param_l strtolower($param);
        if ( 
$param_l == 'owner' $owner htmlspecialchars($vars[$param]);
      }
  }

  
// === Begining of this script ...
  
$max_size 64;
  
  
$sql "select * from ".$this->config["table_prefix"]."pages where latest = 'Y' ";
  if ( isset(
$owner) && ! empty($owner) ) $sql .= ' and LOWER(OWNER) = "' strtolower($owner) . '" ';
  
$sql .= "order by tag";

  echo 
'<table cellpadding="1" cellpadding="2" border="0">';
  foreach (
$this->LoadAll($sql) as $page)
  {
    echo 
'<tr>';
    
    
$size round(100 strlen($page['body']) / (1024 100));
    
$sql "select count(*) from ".$this->config["table_prefix"]."pages where tag = '" $page['tag'] . "' ";
    
$res $this->Query($sql);
    
$nb_versions mysql_result($res0);

    echo 
'<td>Page <strong>' $this->Format($page['tag']) . '</strong></td>';
    echo 
'<td><strong>' $size '</strong> ko</td>';
    echo 
'<td>';

    echo 
'<table width="100%" border="0" cellpadding="0" cellspacing="1">';
    
        if ( 
$size != ) {
            
$percent $size 100 $max_size ;
            
$percent round($percent*100)/100 ;
            if (
$percent == 0$percent "0,00" ;
        }
        else {
            
$percent "0,00" ;
        }
                
    if ( 
$percent 60 )
    {
      
$img_left  'interface/vote_red_left.gif';
      
$img_right 'interface/vote_red_right.gif';
      
$img_bar   'interface/vote_red_bar.gif';
    }
    else
    {
      
$img_left  'interface/vote_blue_left.gif';
      
$img_right 'interface/vote_blue_right.gif';
      
$img_bar   'interface/vote_blue_bar.gif';
    }
    
$width round($percent 200 200); // width en pixels

    
echo '<tr height="12"><td align="left" valign="middle">' ;
    echo 
'<img src="' $img_left '" height="12"><img src="' $img_bar '" height="12" width="'.$width.'"><img src="' $img_right '" height="12">';
    echo 
'</td></tr>';
    echo 
'</table>';
    
    echo 
'</td>';
    echo 
'<td>' $this->Format($page['owner']) . '</td>';
    echo 
'<td><b>' $nb_versions '</b>&nbsp;versions</td>';
    echo 
'<td><font size="-2">' $page['time'] . '</font></td>';

    echo 
'<td>';
    if ( ! empty(
$page['comment_on']) ) echo '<font size="-2">[&nbsp;' $lng_strings['S_COMMENTS']. '&nbsp;]</font>';
    echo 
'</td>';
    echo
'</tr>';
  }
  echo 
'</table>';

?>


Après il ne reste plus qu'à uploader les petites images pour faire les barres de taille (ou supprimer cette portion si vous ne voulez pas d'indications visuelles).
Les images sont à mettre dans (par ex., changer dans le script sinon) le répertoire interface/ à la racine du wikki).

Action inconnue "attach"
Damn, pas d'actions attach ?
Voir ici alors.

-- Sergio

Je me suis permis deux petites modification dans ton code :
echo '<img src="' . $img_left . '" height="12" class="imgnoborder"><img src="' . $img_bar . '" height="12" width="'.$width.'" class="imgnoborder"><img src="' . $img_right . '" height="12" class="imgnoborder">';

Je vois quelques autres problèmes :
-- CharlesNepote


Corrélats


Commentaires [Cacher commentaires/formulaire]