Search the Community
Showing results for tags 'Tab Delimited'.
-
Hi there, I've got some code that bulk uploads the contents of Tab Delimited files into our Processwire CMS. It looks like the $page->save functionality stops working after a certain number has been processed. Haven't worked out where it starts failing yet but all the rows towards the bottom have certainly failed. Unfortunately, there isn't anything in the error logs (at least the php error log) to see if there is an issue. I have tested the rows that were not working by putting them individually in seperate tsv files to prove that the code works, the data is clean and it actually updates the CMS. I was wondering if there's an internal limit on how many page saves the CMS can handle? Thanks in advance. Below is the copy of the code I'm using to do a bulk upload. I'm using a 3rd party module called SimpleExcel to help with the reading and processing of the tab delimited files. $_rowStart = 13; $_colTitle = 1; //A $_colMeta = 10;//J Meta Title = SEO Title $_colDesc = 11;//K $_colURL = 12;//L $_colURLnew = 13;//M $_colCanonical = 14;//N $_colAlt = 15;//O $_colKeywords = 16;//P $excel = new SimpleExcel('TSV'); $excel->parser->loadFile(__DIR__."/{$file}"); //$url = $excel->parser->getCell($_rowStart, $_colURL ); $row= $_rowStart; do { $title = $excel->parser->getCell($row, $_colTitle ); $meta = $excel->parser->getCell($row, $_colMeta ); $desc = $excel->parser->getCell($row, $_colDesc ); $url = $excel->parser->getCell($row, $_colURL ); $urlnew = $excel->parser->getCell($row, $_colURLnew ); $canonical= $excel->parser->getCell($row, $_colCanonical ); $alt = $excel->parser->getCell($row, $_colAlt ); $keywords= $excel->parser->getCell($row, $_colKeywords ); $internal= str_replace("http://sprachspielspass.de",'',$url); $page = wire(pages)->get("path=$internal"); //TODO: Error handling and logging if (!IsNullPage($page)) { $page->setOutputFormatting(false); $page->title = $title; $page->seo_title = $meta; $page->seo_description = $desc; $page->url = $urlnew; $page->seo_canonical = $canonical; $page->image_alt = $alt; $page->seo_keywords = $keywords; $page->Save(); WriteLog("{$internal} saved"); } else { WriteLog("{$internal} NOT FOUND!"); } $row++; } while (!IsNullOrEmptyString($url));
- 6 replies
-
- $Page
- Bulk Upload
-
(and 5 more)
Tagged with: