Johannes C. Schulz
Johannes C. Schulz

Reputation: 482

TYPO3 CMS EXT:webkitpdf error CacheDatabaseBackend TYPO3 9.5

Because the famous extension webkitpdf isn't maintained anymore, I try my very best to get this working under TYPO3 9.5. My patched version https://github.com/EnzephaloN/typo3-extension-webkitpdf worked fine til 8.7, but now I get an error in Classes/Utility/CacheDatabaseBackend.php::set

/**
     * Saves data in a cache file.
     *
     * @param string $entryIdentifier An identifier for this specific cache entry
     * @param string $data The data to be stored
     * @param array $tags Tags to associate with this cache entry
     * @param integer $lifetime Lifetime of this cache entry in seconds. If NULL is specified, the default lifetime is used. "0" means unlimited liftime.
     * @return void
     */
    public function set($entryIdentifier, $data, array $tags = array(), $lifetime = NULL) {
        if ($this->maximumNumberOfEntries > 0 && !$this->has($entryIdentifier)) {
            $this->removeOldEntriesIfRequired();
        }
        parent::set($entryIdentifier, $data, $tags, $lifetime);
    }

The parent::set($entryIdentifier, $data, $tags, $lifetime); results an Cannot call abstract method TYPO3\CMS\Core\Cache\Backend\BackendInterface::set() error.

Anyone an idea how to adjust this method to TYPO3 9.5??

Tried to extend from \TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend which caused a lot of trouble with different errors in backend.

For now I disabled calling parent::set(... - so it works without cache, but without errors.

Upvotes: 0

Views: 51

Answers (1)

David
David

Reputation: 6084

In the BackendInterface the function set is defined like this:

public function set($entryIdentifier, $data, array $tags = [], $lifetime = null);

Nevertheless it never has a concrete function in class AbstractBackend in TYPO3 version 9. Probably in Version 8 that's different and the reason that it still worked.

So you've to define the function in your own class and it has to satisfy the requirements predefined in the BackendInterface like shown above.

To get an idea what the function is doing look in TYPO3 7 or 8. Even if you've to adjust it perhaps that might be useful.

EDIT: In general to keep the call with parent::set(...); in your own function you still had to create another class. This is probably not required if you don't need the functionality additionally in another place.
In general you can just search in older versions what the function did there and integrate that functionality in your existing function set(...).

Upvotes: 0

Related Questions