Code
function book_searchapi_search($args)
{
pnModDBInfoLoad('Search');
$pntable = pnDBGetTables();
$booktable = $pntable['book'];
$bookcolumn = $pntable['book_column'];
$searchTable = $pntable['search_result'];
$searchColumn = $pntable['search_result_column'];
$where = search_construct_where($args,
array($bookcolumn['title'],
$bookcolumn['contents']),
$bookcolumn['lang']);
$sessionId = session_id();
$insertSql =
"INSERT INTO $searchTable
($searchColumn[title],
$searchColumn[text],
$searchColumn[extra],
$searchColumn[module],
$searchColumn[created],
$searchColumn[session])
VALUES ";
pnModAPILoad('Book', 'user');
$permChecker = new book_result_checker();
$stories = DBUtil::selectObjectArrayFilter('book', $where, null, null, null, '', $permChecker, null);
foreach ($stories as $story)
{
$sql = $insertSql . '('
. '\'' . DataUtil::formatForStore($story['title']) . '\', '
. '\'' . DataUtil::formatForStore($story['contents']) . '\', '
. '\'' . DataUtil::formatForStore($story['art_id']) . '\', '
. '\'' . 'Book' . '\', '
. '\'' . '' . '\', '
. '\'' . DataUtil::formatForStore($sessionId) . '\')';
$insertResult = DBUtil::executeSQL($sql);
if (!$insertResult) {
return LogUtil::registerError (_GETFAILED);
}
}
return true;
}
{
pnModDBInfoLoad('Search');
$pntable = pnDBGetTables();
$booktable = $pntable['book'];
$bookcolumn = $pntable['book_column'];
$searchTable = $pntable['search_result'];
$searchColumn = $pntable['search_result_column'];
$where = search_construct_where($args,
array($bookcolumn['title'],
$bookcolumn['contents']),
$bookcolumn['lang']);
$sessionId = session_id();
$insertSql =
"INSERT INTO $searchTable
($searchColumn[title],
$searchColumn[text],
$searchColumn[extra],
$searchColumn[module],
$searchColumn[created],
$searchColumn[session])
VALUES ";
pnModAPILoad('Book', 'user');
$permChecker = new book_result_checker();
$stories = DBUtil::selectObjectArrayFilter('book', $where, null, null, null, '', $permChecker, null);
foreach ($stories as $story)
{
$sql = $insertSql . '('
. '\'' . DataUtil::formatForStore($story['title']) . '\', '
. '\'' . DataUtil::formatForStore($story['contents']) . '\', '
. '\'' . DataUtil::formatForStore($story['art_id']) . '\', '
. '\'' . 'Book' . '\', '
. '\'' . '' . '\', '
. '\'' . DataUtil::formatForStore($sessionId) . '\')';
$insertResult = DBUtil::executeSQL($sql);
if (!$insertResult) {
return LogUtil::registerError (_GETFAILED);
}
}
return true;
}
This code will work just fine on my local server, but fails on the production server. I was able to replicate the problem on my local machine by setting the memory limit to 8M, and increasing it back fixed it. However, when I tried setting the local memory limit to 32M on my production server, it still failed. If I turn debugging on, this is what I get as a readout.
Code
Exit-Handler: Invalid table-key [faqanswer] passed to _getAllColumns
Stacktrace:
1. (array) 0:
1. (string) file = /home/virtual/site9/fst/var/www/html/includes/pnobjlib/DBUtil.class.php
2. (integer) line = 379
3. (string) function = pn_exit
4. (array) args:
1. (string) 0 = Invalid table-key [faqanswer] passed to _getAllColumns
2. (array) 1:
1. (string) file = /home/virtual/site9/fst/var/www/html/includes/pnobjlib/DBUtil.class.php
2. (integer) line = 350
3. (string) function = _getallcolumns
4. (string) class = dbutil
5. (string) type = ::
6. (array) args:
1. (string) 0 = faqanswer
2. (null) 1 = (none)
3. (array) 2:
1. (string) file = /home/virtual/site9/fst/var/www/html/includes/pnobjlib/DBUtil.class.php
2. (integer) line = 1475
3. (string) function = _getselectallcolumnsfrom
4. (string) class = dbutil
5. (string) type = ::
6. (array) args:
1. (string) 0 = faqanswer
2. (string) 1 = WHERE ( ( LIKE '%atp%' OR LIKE '%atp%'))
3. (string) 2 = ORDER BY faqid
4. (null) 3 = (none)
4. (array) 3:
1. (string) file = /home/virtual/site9/fst/var/www/html/modules/FAQ/pnsearchapi.php
2. (integer) line = 62
3. (string) function = selectobjectarray
4. (string) class = dbutil
5. (string) type = ::
6. (array) args:
1. (string) 0 = faqanswer
2. (string) 1 = ( ( LIKE '%atp%' OR LIKE '%atp%'))
3. (string) 2 = faqid
4. (integer) 3 = 1
5. (integer) 4 = -1
6. (string) 5 =
7. (array) 6:
1. (array) 0:
1. (integer) realm = 0
2. (string) component_left = FAQ
3. (string) instance_left = faqid
4. (string) instance_right =
5. (integer) level = 200
5. (array) 4:
1. (string) file = /home/virtual/site9/fst/var/www/html/includes/pnMod.php
2. (integer) line = 670
3. (string) function = faq_searchapi_search
4. (array) args:
1. (array) 0:
1. (string) q = atp
2. (string) searchtype = AND
3. (string) searchorder = newest
4. (integer) numlimit = 20
5. (integer) page = 1
6. (integer) startnum = 1
6. (array) 5:
1. (string) file = /home/virtual/site9/fst/var/www/html/includes/pnMod.php
2. (integer) line = 633
3. (string) function = pnmodfuncexec
4. (array) args:
1. (string) 0 = FAQ
2. (string) 1 = search
3. (string) 2 = search
4. (array) 3:
1. (string) q = atp
2. (string) searchtype = AND
3. (string) searchorder = newest
4. (integer) numlimit = 20
5. (integer) page = 1
6. (integer) startnum = 1
5. (boolean) 4 = 1
7. (array) 6:
1. (string) file = /home/virtual/site9/fst/var/www/html/system/Search/pnuser.php
2. (integer) line = 356
3. (string) function = pnmodapifunc
4. (array) args:
1. (string) 0 = FAQ
2. (string) 1 = search
3. (string) 2 = search
4. (array) 3:
1. (string) q = atp
2. (string) searchtype = AND
3. (string) searchorder = newest
4. (integer) numlimit = 20
5. (integer) page = 1
6. (integer) startnum = 1
8. (array) 7:
1. (string) file = /home/virtual/site9/fst/var/www/html/includes/pnMod.php
2. (integer) line = 670
3. (string) function = search_user_search
4. (array) args:
1. (array) 0: (empty)
9. (array) 8:
1. (string) file = /home/virtual/site9/fst/var/www/html/includes/pnMod.php
2. (integer) line = 607
3. (string) function = pnmodfuncexec
4. (array) args:
1. (string) 0 = Search
2. (string) 1 = user
3. (string) 2 = search
4. (array) 3: (empty)
10. (array) 9:
1. (string) file = /home/virtual/site9/fst/var/www/html/index.php
2. (integer) line = 99
3. (string) function = pnmodfunc
4. (array) args:
1. (string) 0 = Search
2. (string) 1 = user
3. (string) 2 = search
4. (array) 3: (empty)
Stacktrace:
1. (array) 0:
1. (string) file = /home/virtual/site9/fst/var/www/html/includes/pnobjlib/DBUtil.class.php
2. (integer) line = 379
3. (string) function = pn_exit
4. (array) args:
1. (string) 0 = Invalid table-key [faqanswer] passed to _getAllColumns
2. (array) 1:
1. (string) file = /home/virtual/site9/fst/var/www/html/includes/pnobjlib/DBUtil.class.php
2. (integer) line = 350
3. (string) function = _getallcolumns
4. (string) class = dbutil
5. (string) type = ::
6. (array) args:
1. (string) 0 = faqanswer
2. (null) 1 = (none)
3. (array) 2:
1. (string) file = /home/virtual/site9/fst/var/www/html/includes/pnobjlib/DBUtil.class.php
2. (integer) line = 1475
3. (string) function = _getselectallcolumnsfrom
4. (string) class = dbutil
5. (string) type = ::
6. (array) args:
1. (string) 0 = faqanswer
2. (string) 1 = WHERE ( ( LIKE '%atp%' OR LIKE '%atp%'))
3. (string) 2 = ORDER BY faqid
4. (null) 3 = (none)
4. (array) 3:
1. (string) file = /home/virtual/site9/fst/var/www/html/modules/FAQ/pnsearchapi.php
2. (integer) line = 62
3. (string) function = selectobjectarray
4. (string) class = dbutil
5. (string) type = ::
6. (array) args:
1. (string) 0 = faqanswer
2. (string) 1 = ( ( LIKE '%atp%' OR LIKE '%atp%'))
3. (string) 2 = faqid
4. (integer) 3 = 1
5. (integer) 4 = -1
6. (string) 5 =
7. (array) 6:
1. (array) 0:
1. (integer) realm = 0
2. (string) component_left = FAQ
3. (string) instance_left = faqid
4. (string) instance_right =
5. (integer) level = 200
5. (array) 4:
1. (string) file = /home/virtual/site9/fst/var/www/html/includes/pnMod.php
2. (integer) line = 670
3. (string) function = faq_searchapi_search
4. (array) args:
1. (array) 0:
1. (string) q = atp
2. (string) searchtype = AND
3. (string) searchorder = newest
4. (integer) numlimit = 20
5. (integer) page = 1
6. (integer) startnum = 1
6. (array) 5:
1. (string) file = /home/virtual/site9/fst/var/www/html/includes/pnMod.php
2. (integer) line = 633
3. (string) function = pnmodfuncexec
4. (array) args:
1. (string) 0 = FAQ
2. (string) 1 = search
3. (string) 2 = search
4. (array) 3:
1. (string) q = atp
2. (string) searchtype = AND
3. (string) searchorder = newest
4. (integer) numlimit = 20
5. (integer) page = 1
6. (integer) startnum = 1
5. (boolean) 4 = 1
7. (array) 6:
1. (string) file = /home/virtual/site9/fst/var/www/html/system/Search/pnuser.php
2. (integer) line = 356
3. (string) function = pnmodapifunc
4. (array) args:
1. (string) 0 = FAQ
2. (string) 1 = search
3. (string) 2 = search
4. (array) 3:
1. (string) q = atp
2. (string) searchtype = AND
3. (string) searchorder = newest
4. (integer) numlimit = 20
5. (integer) page = 1
6. (integer) startnum = 1
8. (array) 7:
1. (string) file = /home/virtual/site9/fst/var/www/html/includes/pnMod.php
2. (integer) line = 670
3. (string) function = search_user_search
4. (array) args:
1. (array) 0: (empty)
9. (array) 8:
1. (string) file = /home/virtual/site9/fst/var/www/html/includes/pnMod.php
2. (integer) line = 607
3. (string) function = pnmodfuncexec
4. (array) args:
1. (string) 0 = Search
2. (string) 1 = user
3. (string) 2 = search
4. (array) 3: (empty)
10. (array) 9:
1. (string) file = /home/virtual/site9/fst/var/www/html/index.php
2. (integer) line = 99
3. (string) function = pnmodfunc
4. (array) args:
1. (string) 0 = Search
2. (string) 1 = user
3. (string) 2 = search
4. (array) 3: (empty)
Doe this help anyone figure out what is going on? If I put in a print/debug statement I show that the search page executes completely through my searchapi and fills the table correctly. Any and all help appreciated.
