| | |
| | | private function __construct(string $source) |
| | | { |
| | | $this->source = $source; |
| | | $this->cache = Cache::for('icons_' . $source, WEEK_IN_SECONDS); |
| | | $this->cache = Cache::for('icons_' . $source); |
| | | $this->style = Site::icon(); |
| | | |
| | | $this->addMap(); |
| | |
| | | $instance->archiveCurrentVersion($css); |
| | | |
| | | if (file_put_contents($css_path, $css) !== false) { |
| | | Cache::touch('icons_' . $source); |
| | | Cache::for('icons_'.$source)->flush(); |
| | | error_log("[IconsManager] Updated {$source}.css"); |
| | | } else { |
| | | error_log("[IconsManager] Could not write {$source}.css"); |
| | |
| | | $instance->archiveCurrentVersion($css); |
| | | |
| | | if (file_put_contents($css_path, $css) !== false) { |
| | | Cache::touch('icons_' . $source); |
| | | Cache::for('icons_'.$source)->flush(); |
| | | error_log("[IconsManager] Updated {$source}.css"); |
| | | } else { |
| | | error_log("[IconsManager] Could not write {$source}.css"); |
| | |
| | | |
| | | public function registerStyle(): void |
| | | { |
| | | $timestamp = Cache::lastModified('icons_' . $this->source); |
| | | $timestamp = Cache::for('icons_'.$this->source)->getTimestamp(); |
| | | $handle = 'jvb-icons-' . $this->source; |
| | | |
| | | wp_register_style( |
| | |
| | | if (file_put_contents($css_path, $entry['css']) !== false) { |
| | | $this->icons = $entry['iconList']; |
| | | $this->saveIcons(); |
| | | Cache::touch('icons_' . $this->source); |
| | | Cache::for('icons_'.$this->source)->flush(); |
| | | return true; |
| | | } |
| | | |
| | |
| | | } |
| | | $needsUpdate[$this->source] = true; |
| | | update_option(BASE.'icons_needs_update', $needsUpdate); |
| | | Cache::touch('icons_' . $this->source); |
| | | |
| | | Cache::for('icons_'.$this->source)->flush(); |
| | | } |
| | | |
| | | public function mergeVersions(array $timestamps): bool |