25 lines
		
	
	
		
			587 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
		
		
			
		
	
	
			25 lines
		
	
	
		
			587 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| 
								 | 
							
								<?php // "name":"Watch files and act when they are changed", "author":"Noccy"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								namespace SparkPlug\Com\Noccy\Watcher;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								class WatcherPlug extends \SparkPlug {
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    private ?FileWatcher $watcher = null;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    public function load()
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        register_command(new Commands\WatchCommand());
							 | 
						||
| 
								 | 
							
								        //register_command(new PdoExecCommand());
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    public function getFileWatcher(): FileWatcher
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        if (!$this->watcher) {
							 | 
						||
| 
								 | 
							
								            $this->watcher = new FileWatcher();
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								        return $this->watcher;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								register_plugin("com.noccy.watcher", new WatcherPlug);
							 |