Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Content manager update for large databases
- Loading branch information
Laca
committed
May 18, 2016
1 parent
96a0208
commit 1245fb3
Showing
7 changed files
with
323 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
error_reporting( E_ALL ); | ||
ini_set( 'display_errors', 0 ); | ||
|
||
define( 'DACCESS', 1 ); | ||
|
||
define( 'APATH', dirname( __FILE__ ) ); | ||
|
||
$settings = APATH . '/../../../../settings.php'; | ||
$idiorm_lib = APATH . '/../../../../lib/idiorm/idiorm.php'; | ||
|
||
if ( ! is_file( $settings ) || ! is_readable( $settings ) ) die( 'M_ERROR (00110): A required file: settings.php is missing or not readable!' ); | ||
else include( $settings ); | ||
|
||
if ( ! is_file( $idiorm_lib ) || ! is_readable( $idiorm_lib ) ) die( 'M_ERROR (00111): A required file: idiorm.php is missing or not readable!' ); | ||
else include( $idiorm_lib ); | ||
|
||
ORM::configure('mysql:host=' . MSettings::$db_host . ';dbname=' . MSettings::$db); | ||
ORM::configure('username', MSettings::$db_user); | ||
ORM::configure('password', MSettings::$db_pass); | ||
ORM::configure('return_result_sets', true); // returns result sets | ||
ORM::configure('driver_options', array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')); | ||
|
||
$string = strtolower($_GET["q"]); | ||
if (!$string) return; | ||
|
||
$TheData = ORM::for_table('contents')->distinct()->select('address')->where_like('address', '%'.$string.'%')->limit(20)->order_by_expr('CHAR_LENGTH(`address`)')->find_array(); | ||
|
||
foreach ($TheData as $key => $value) { | ||
$cname = $value['address']; | ||
echo "$cname\n"; | ||
} | ||
?> |
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