protected function loadPage() { $table = new PhameBlog(); $conn_r = $table->establishConnection('r'); $where_clause = $this->buildWhereClause($conn_r); $order_clause = $this->buildOrderClause($conn_r); $limit_clause = $this->buildLimitClause($conn_r); $data = queryfx_all($conn_r, 'SELECT * FROM %T b %Q %Q %Q', $table->getTableName(), $where_clause, $order_clause, $limit_clause); $blogs = $table->loadAllFromArray($data); return $blogs; }
public function execute() { $table = new PhameBlog(); $conn_r = $table->establishConnection('r'); $where_clause = $this->buildWhereClause($conn_r); $order_clause = $this->buildOrderClause($conn_r); $limit_clause = $this->buildLimitClause($conn_r); $data = queryfx_all($conn_r, 'SELECT * FROM %T b %Q %Q %Q', $table->getTableName(), $where_clause, $order_clause, $limit_clause); $blogs = $table->loadAllFromArray($data); if ($blogs) { if ($this->needBloggers) { $this->loadBloggers($blogs); } } return $blogs; }
<?php $table = new PhameBlog(); $conn_w = $table->establishConnection('w'); $iterator = new LiskMigrationIterator($table); foreach ($iterator as $blog) { $id = $blog->getID(); echo pht('Adding mail key for Blog %d...', $id); echo "\n"; queryfx($conn_w, 'UPDATE %T SET mailKey = %s WHERE id = %d', $table->getTableName(), Filesystem::readRandomCharacters(20), $id); }