forked from grumpydevelop/federator
		
	minor fixes for testing-file
This commit is contained in:
		
							parent
							
								
									2ae81a3748
								
							
						
					
					
						commit
						61f6fe3e7b
					
				
					 1 changed files with 12 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -91,6 +91,9 @@ class Test
 | 
			
		|||
        // pretend that we are running from web directory
 | 
			
		||||
        define('PROJECT_ROOT', dirname(__DIR__, 2));
 | 
			
		||||
        $api = new \Federator\Api();
 | 
			
		||||
        $api->loadPlugins();
 | 
			
		||||
        $api->openDatabase();
 | 
			
		||||
 | 
			
		||||
        for ($i = 1; $i < $argc; ++$i) {
 | 
			
		||||
            switch ($argv[$i]) {
 | 
			
		||||
                case 'fetchoutbox':
 | 
			
		||||
| 
						 | 
				
			
			@ -109,18 +112,18 @@ class Test
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * print usage of maintenance tool
 | 
			
		||||
     * print usage of test tool
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public static function printUsage()
 | 
			
		||||
    {
 | 
			
		||||
        echo "usage php maintenance.php <command> <parameter> [<command> <parameter>...]\n";
 | 
			
		||||
        echo "usage php test.php <command> <parameter> [<command> <parameter>...]\n";
 | 
			
		||||
        echo "command can be one of:\n";
 | 
			
		||||
        echo " fetchoutbox - fetch users outbox. parameter: username\n";
 | 
			
		||||
        echo " upvote - upvote. parameter: URL to upvote\n";
 | 
			
		||||
        echo " downvote - downvote. parameter: URL to downvote\n";
 | 
			
		||||
        echo " comment - downvote. parameter: URL to comment, text to comment\n";
 | 
			
		||||
        echo " comment - comment. parameter: URL to comment, text to comment\n";
 | 
			
		||||
        echo " Run this after you updated the program files\n";
 | 
			
		||||
        exit();
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -136,13 +139,16 @@ class Test
 | 
			
		|||
    public static function upvote($api, $_url)
 | 
			
		||||
    {
 | 
			
		||||
        $dbh = $api->getDatabase();
 | 
			
		||||
        $inboxActivity = new \Federator\Data\ActivityPub\Common\Create();
 | 
			
		||||
        $inboxActivity = new \Federator\Data\ActivityPub\Common\Like();
 | 
			
		||||
        $inboxActivity->setAActor('https://mastodon.local/users/admin');
 | 
			
		||||
        $inboxActivity->setObject($_url);
 | 
			
		||||
        $inboxActivity->setID("https://mastodon.local/users/admin#like/" . md5($_url));
 | 
			
		||||
        \Federator\Api\FedUsers\Inbox::postForUser(
 | 
			
		||||
            $dbh,
 | 
			
		||||
            $api->getConnector(),
 | 
			
		||||
            null,
 | 
			
		||||
            'grumpydevelop',
 | 
			
		||||
            $_url,
 | 
			
		||||
            'admin@mastodon.local',
 | 
			
		||||
            "grumpydevelop@192.168.178.143",
 | 
			
		||||
            $inboxActivity
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue