Bonjour,
Je suis actuellement un peu dans la misère du passage d'une application en php 4 sur un serveur php 5, et j'ai un soucis avec la fonction aggregate qui n'existe plus sous PHP5. En regardant un peu il semblerait qu'il faut que je passe par la lib runkit, mais voilà je ne vois pas du tout comment effectuer mes modifs...
Je vous mets le code php 4, je ne vous mets pas tout mais juste le principal
Donc mon but est d'adapter les dernières fonctions, là il y en a que 2 j'ai bien plus que ça à modifier ...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65 class champ { function getAlias() { return $this->name; } function getTable() { return $this->table; } function getLen() { return $this->max_length; } function getType() { return $this->type; } function isNotNull() { return !empty($this->not_null); } function isPk() { return !empty($this->primary_key); } function isUniqueKey() { return !empty($this->unique_key); } function isMultipleKey() { return !empty($this->multiple_key); } function isBlob() { return !empty($this->blob); } function isUnsigned() { return !empty($this->unsigned); } function isZerofill() { return !empty($this->zerofill); } function isBinary() { return !empty($this->binary); } function isEnum() { return !empty($this->enum); } function isNumeric() { return !empty($this->numeric); } } class db{ var $link; var $ok; var $errno; var $error; var $sql; var $auto_id; var $affected_rows; var $res; var $log; // pour le suivi des erreurs par pear Log var $logFile; function db_result() { $this->ok = true; $this->errno = 0; $this->error = ""; $this->sql = ""; $this->auto_id = 0; $this->affected_rows = 0; } function db($new_link=false) { static $link; $this->initLogger(); if (empty($link) || $new_link) { require("vars_adm.php"); $this->link = mysql_connect($host, $user, $mdp, $new_link) or die ("Impossible d'atteindre MySQL"); mysql_select_db($nomdb, $this->link) or die ("Impossible d'accéder à ".$nomdb); if (!$new_link) $link = $this->link; } else $this->link = $link; $this->db_result(); } function isOk() { return $this->ok; } ..... function getSql() { return $this->sql; } function getAutoId() { return $this->isOk() ? $this->auto_id : -1; } function getAffectedRows() { return $this->isOk() ? $this->affected_rows : 0; } function getNbRows() { return $this->isOk() ? mysql_num_rows($this->res) : 0; } function getNbCols() { return $this->isOk() ? mysql_num_fields($this->res) : 0; } function getNomCol($i) { $field = mysql_fetch_field($this->res,$i); aggregate($field,"champ"); return $field->getAlias(); } function getTypeCol($i) { $field = mysql_fetch_field($this->res,$i); aggregate($field,"champ"); return $field->getType(); }
J'ai regarder les fonction du runkit, mais je n'ai pas compris le fonctionnement...
Merci pour l'aide que vous pourriez m'apporter
Partager