GS_DataObject.php 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <?php
  2. if (!defined('GNUSOCIAL')) { exit(1); }
  3. class GS_DataObject extends DB_DataObject
  4. {
  5. public function _autoloadClass($class, $table=false)
  6. {
  7. // avoid those annoying PEAR::DB strict standards warnings it causes
  8. $old = error_reporting();
  9. error_reporting(error_reporting() & ~E_STRICT);
  10. $res = parent::_autoloadClass($class, $table);
  11. // reset
  12. error_reporting($old);
  13. return $res;
  14. }
  15. // wraps the _connect call so we don't throw E_STRICT warnings during it
  16. public function _connect()
  17. {
  18. // avoid those annoying PEAR::DB strict standards warnings it causes
  19. $old = error_reporting();
  20. error_reporting(error_reporting() & ~E_STRICT);
  21. $res = parent::_connect();
  22. // reset
  23. error_reporting($old);
  24. return $res;
  25. }
  26. // wraps the _loadConfig call so we don't throw E_STRICT warnings during it
  27. // doesn't actually return anything, but we'll follow the same model as the rest of the wrappers
  28. public function _loadConfig()
  29. {
  30. // avoid those annoying PEAR::DB strict standards warnings it causes
  31. $old = error_reporting();
  32. error_reporting(error_reporting() & ~E_STRICT);
  33. $res = parent::_loadConfig();
  34. // reset
  35. error_reporting($old);
  36. return $res;
  37. }
  38. // wraps the count call so we don't throw E_STRICT warnings during it
  39. public function count($countWhat = false,$whereAddOnly = false)
  40. {
  41. // avoid those annoying PEAR::DB strict standards warnings it causes
  42. $old = error_reporting();
  43. error_reporting(error_reporting() & ~E_STRICT);
  44. $res = parent::count($countWhat, $whereAddOnly);
  45. // reset
  46. error_reporting($old);
  47. return $res;
  48. }
  49. static public function debugLevel($v = null)
  50. {
  51. // avoid those annoying PEAR::DB strict standards warnings it causes
  52. $old = error_reporting();
  53. error_reporting(error_reporting() & ~E_STRICT);
  54. $res = parent::debugLevel($v);
  55. // reset
  56. error_reporting($old);
  57. return $res;
  58. }
  59. // delete calls PEAR::isError from DB_DataObject, so let's make that disappear too
  60. public function delete($useWhere = false)
  61. {
  62. // avoid those annoying PEAR::DB strict standards warnings it causes
  63. $old = error_reporting();
  64. error_reporting(error_reporting() & ~E_STRICT);
  65. $res = parent::delete($useWhere);
  66. // reset
  67. error_reporting($old);
  68. return $res;
  69. }
  70. static public function factory($table = '')
  71. {
  72. // avoid those annoying PEAR::DB strict standards warnings it causes
  73. $old = error_reporting();
  74. error_reporting(error_reporting() & ~E_STRICT);
  75. $res = parent::factory($table);
  76. // reset
  77. error_reporting($old);
  78. return $res;
  79. }
  80. public function get($k = null, $v = null)
  81. {
  82. // avoid those annoying PEAR::DB strict standards warnings it causes
  83. $old = error_reporting();
  84. error_reporting(error_reporting() & ~E_STRICT);
  85. $res = parent::get($k, $v);
  86. // reset
  87. error_reporting($old);
  88. return $res;
  89. }
  90. public function fetch()
  91. {
  92. // avoid those annoying PEAR::DB strict standards warnings it causes
  93. $old = error_reporting();
  94. error_reporting(error_reporting() & ~E_STRICT);
  95. $res = parent::fetch();
  96. // reset
  97. error_reporting($old);
  98. return $res;
  99. }
  100. public function find($n = false)
  101. {
  102. // avoid those annoying PEAR::DB strict standards warnings it causes
  103. $old = error_reporting();
  104. error_reporting(error_reporting() & ~E_STRICT);
  105. $res = parent::find($n);
  106. // reset
  107. error_reporting($old);
  108. return $res;
  109. }
  110. public function fetchRow($row = null)
  111. {
  112. // avoid those annoying PEAR::DB strict standards warnings it causes
  113. $old = error_reporting();
  114. error_reporting(error_reporting() & ~E_STRICT);
  115. $res = parent::fetchRow($row);
  116. // reset
  117. error_reporting($old);
  118. return $res;
  119. }
  120. // insert calls PEAR::isError from DB_DataObject, so let's make that disappear too
  121. public function insert()
  122. {
  123. // avoid those annoying PEAR::DB strict standards warnings it causes
  124. $old = error_reporting();
  125. error_reporting(error_reporting() & ~E_STRICT);
  126. $res = parent::insert();
  127. // reset
  128. error_reporting($old);
  129. return $res;
  130. }
  131. // DB_DataObject's joinAdd calls DB_DataObject::factory explicitly, so our factory-override doesn't work
  132. public function joinAdd($obj = false, $joinType='INNER', $joinAs=false, $joinCol=false)
  133. {
  134. // avoid those annoying PEAR::DB strict standards warnings it causes
  135. $old = error_reporting();
  136. error_reporting(error_reporting() & ~E_STRICT);
  137. $res = parent::joinAdd($obj, $joinType, $joinAs, $joinCol);
  138. // reset
  139. error_reporting($old);
  140. return $res;
  141. }
  142. public function links()
  143. {
  144. // avoid those annoying PEAR::DB strict standards warnings it causes
  145. $old = error_reporting();
  146. error_reporting(error_reporting() & ~E_STRICT);
  147. $res = parent::links();
  148. // reset
  149. error_reporting($old);
  150. return $res;
  151. }
  152. // wraps the update call so we don't throw E_STRICT warnings during it
  153. public function update($dataObject = false)
  154. {
  155. // avoid those annoying PEAR::DB strict standards warnings it causes
  156. $old = error_reporting();
  157. error_reporting(error_reporting() & ~E_STRICT);
  158. $res = parent::update($dataObject);
  159. // reset
  160. error_reporting($old);
  161. return $res;
  162. }
  163. static public function staticGet($class, $k, $v = null)
  164. {
  165. // avoid those annoying PEAR::DB strict standards warnings it causes
  166. $old = error_reporting();
  167. error_reporting(error_reporting() & ~E_STRICT);
  168. $res = parent::staticGet($class, $k, $v);
  169. // reset
  170. error_reporting($old);
  171. return $res;
  172. }
  173. public function staticGetAutoloadTable($table)
  174. {
  175. // avoid those annoying PEAR::DB strict standards warnings it causes
  176. $old = error_reporting();
  177. error_reporting(error_reporting() & ~E_STRICT);
  178. $res = parent::staticGetAutoloadTable($table);
  179. // reset
  180. error_reporting($old);
  181. return $res;
  182. }
  183. }