コード例 #1
0
 /**
  * Returns the number of recorded references to the given $path.
  *
  * @param string $uri File IO uri (not legacy)
  *
  * @return int
  */
 public function countImageReferences($uri)
 {
     $path = $this->redecorator->redecorateFromSource($uri);
     $connection = $this->getConnection();
     $selectQuery = $connection->createSelectQuery();
     $selectQuery->select($selectQuery->expr->count($connection->quoteColumn('id')))->from($connection->quoteTable('ezimagefile'))->where($selectQuery->expr->like($connection->quoteColumn('filepath'), $selectQuery->bindValue($path . '%')));
     $statement = $selectQuery->prepare();
     $statement->execute();
     return (int) $statement->fetchColumn();
 }
コード例 #2
0
 /**
  * Returns the XML required by the legacy database.
  *
  * @param array $data
  *
  * @return string
  */
 protected function createLegacyXml(array $data)
 {
     $data['uri'] = $this->urlRedecorator->redecorateFromSource($data['uri']);
     $pathInfo = pathinfo($data['uri']);
     return $this->fillXml($data, $pathInfo, time());
 }
コード例 #3
0
 public function testRedecorateFromSource()
 {
     $this->sourceDecoratorMock->expects($this->once())->method('undecorate')->with('http://static.example.com/images/file.png')->will($this->returnValue('images/file.png'));
     $this->targetDecoratorMock->expects($this->once())->method('decorate')->with('images/file.png')->will($this->returnValue('/var/test/storage/images/file.png'));
     self::assertEquals('/var/test/storage/images/file.png', $this->redecorator->redecorateFromSource('http://static.example.com/images/file.png'));
 }