예제 #1
0
 public function updateProperty(ResourceInterface $resource, XmlName $prop, \DOMElement $value)
 {
     if (!$resource instanceof DatabaseResource) {
         throw new \InvalidArgumentException(sprintf('Expecting a database resource, given %s', get_class($resource)));
     }
     if ($prop->getNamespaceUri() == WebDav::NS_DAV) {
         switch ($prop->getLocalName()) {
             case 'getlastmodified':
                 $stmt = $this->conn->prepare("UPDATE `#__webdav_resource` SET `modified_at` = :time WHERE `id` = :id");
                 $stmt->bindValue('time', $this->parseDate(trim($value->textContent))->getTimestamp());
                 $stmt->bindValue('id', $resource->getIdentifier());
                 $stmt->execute();
                 return;
         }
     }
     if ($prop->getNamespaceUri() == WebDav::NS_WIN32) {
         switch ($prop->getLocalName()) {
             case 'Win32LastModifiedTime':
                 $stmt = $this->conn->prepare("UPDATE `#__webdav_resource` SET `modified_at` = :time WHERE `id` = :id");
                 $stmt->bindValue('time', $this->parseDate(trim($value->textContent))->getTimestamp());
                 $stmt->bindValue('id', $resource->getIdentifier());
                 $stmt->execute();
                 return;
         }
     }
     return parent::updateProperty($resource, $prop, $value);
 }
예제 #2
0
 public function updateProperty(ResourceInterface $resource, XmlName $prop, \DOMElement $value)
 {
     if (!$resource instanceof FilesystemResource) {
         throw new \InvalidArgumentException(sprintf('Expecting a filesystem resource, given %s', get_class($resource)));
     }
     if ($prop->getNamespaceUri() == WebDav::NS_DAV) {
         switch ($prop->getLocalName()) {
             case 'getlastmodified':
                 $text = trim($value->textContent);
                 $date = new \DateTimeImmutable(is_numeric($text) ? '@' . $text : $text);
                 touch($resource->getFileInfo()->getPathname(), $date->getTimestamp());
                 return;
         }
     }
     if ($prop->getNamespaceUri() == WebDav::NS_WIN32) {
         switch ($prop->getLocalName()) {
             case 'Win32LastModifiedTime':
                 $text = trim($value->textContent);
                 $date = new \DateTimeImmutable(is_numeric($text) ? '@' . $text : $text);
                 touch($resource->getFileInfo()->getPathname(), $date->getTimestamp());
                 return;
         }
     }
     return parent::updateProperty($resource, $prop, $value);
 }