mirrored from git://git.moodle.org/moodle.git
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
import of new ADODB v4.92 library
- Loading branch information
skodak
committed
Aug 29, 2006
1 parent
a199036
commit c0e3c8d
Showing
99 changed files
with
438 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
<?php | ||
|
||
// security - hide paths | ||
if (!defined('ADODB_DIR')) die(); | ||
|
||
global $ADODB_INCLUDED_MEMCACHE; | ||
$ADODB_INCLUDED_MEMCACHE = 1; | ||
|
||
/* | ||
V4.90 8 June 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved. | ||
Released under both BSD license and Lesser GPL library license. | ||
Whenever there is any discrepancy between the two licenses, | ||
the BSD license will take precedence. See License.txt. | ||
Set tabs to 4 for best viewing. | ||
Latest version is available at http://adodb.sourceforge.net | ||
*/ | ||
|
||
function &getmemcache($key,&$err, $timeout=0, $host, $port) | ||
{ | ||
$false = false; | ||
$err = false; | ||
|
||
if (!function_exists('memcache_pconnect')) { | ||
$err = 'Memcache module PECL extension not found!'; | ||
return $false; | ||
} | ||
|
||
$memcache = new Memcache; | ||
if (!@$memcache->pconnect($host, $port)) { | ||
$err = 'Can\'t connect to memcache server on: '.$host.':'.$port; | ||
return $false; | ||
} | ||
|
||
$rs = $memcache->get($key); | ||
if (!$rs) { | ||
$err = 'Item with such key doesn\'t exists on the memcached server.'; | ||
return $false; | ||
} | ||
|
||
$tdiff = intval($rs->timeCreated+$timeout - time()); | ||
if ($tdiff <= 2) { | ||
switch($tdiff) { | ||
case 2: | ||
if ((rand() & 15) == 0) { | ||
$err = "Timeout 2"; | ||
return $false; | ||
} | ||
break; | ||
case 1: | ||
if ((rand() & 3) == 0) { | ||
$err = "Timeout 1"; | ||
return $false; | ||
} | ||
break; | ||
default: | ||
$err = "Timeout 0"; | ||
return $false; | ||
} | ||
} | ||
return $rs; | ||
} | ||
|
||
function putmemcache($key, $rs, $host, $port, $compress, $debug=false) | ||
{ | ||
$false = false; | ||
$true = true; | ||
|
||
if (!function_exists('memcache_pconnect')) { | ||
if ($debug) ADOConnection::outp(" Memcache module PECL extension not found!<br>\n"); | ||
return $false; | ||
} | ||
|
||
$memcache = new Memcache; | ||
if (!@$memcache->pconnect($host, $port)) { | ||
if ($debug) ADOConnection::outp(" Can't connect to memcache server on: $host:$port<br>\n"); | ||
return $false; | ||
} | ||
|
||
$rs->timeCreated = time(); | ||
if (!$memcache->set($key, $rs, $compress, 0)) { | ||
if ($debug) ADOConnection::outp(" Failed to save data at the memcached server!<br>\n"); | ||
return $false; | ||
} | ||
return $true; | ||
} | ||
|
||
function flushmemcache($key=false, $host, $port, $debug=false) | ||
{ | ||
if (!function_exists('memcache_pconnect')) { | ||
if ($debug) ADOConnection::outp(" Memcache module PECL extension not found!<br>\n"); | ||
return; | ||
} | ||
|
||
$memcache = new Memcache; | ||
if (!@$memcache->pconnect($host, $port)) { | ||
if ($debug) ADOConnection::outp(" Can't connect to memcache server on: $host:$port<br>\n"); | ||
return; | ||
} | ||
|
||
if ($key) { | ||
if (!$memcache->delete($key)) { | ||
if ($debug) ADOConnection::outp("CacheFlush: $key entery doesn't exist on memcached server!<br>\n"); | ||
} else { | ||
if ($debug) ADOConnection::outp("CacheFlush: $key entery flushed from memcached server!<br>\n"); | ||
} | ||
} else { | ||
if (!$memcache->flush()) { | ||
if ($debug) ADOConnection::outp("CacheFlush: Failure flushing all enteries from memcached server!<br>\n"); | ||
} else { | ||
if ($debug) ADOConnection::outp("CacheFlush: All enteries flushed from memcached server!<br>\n"); | ||
} | ||
} | ||
return; | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.