function tsitemapUninstall($self)
{
    turlmap::unsub($self);
    tcron::i()->deleteclass($self);
    $meta = tmetawidget::i();
    $meta->delete('sitemap');
}
function tpollsmanUninstall($self)
{
    tcontentfilter::i()->unbind($self);
    tcron::i()->deleteclass(get_class($self));
    $posts = tposts::i();
    $posts->syncmeta = false;
    $posts->unbind($self);
    litepublisher::$db->table = 'postsmeta';
    litepublisher::$db->delete("name = 'poll'");
}
function tpostsUninstall($self)
{
    if ('tposts' != get_class($self)) {
        return;
    }
    $Cron = tcron::i();
    $Cron->deleteclass(get_class($self));
    $widgets = twidgets::i();
    $widgets->deleteclass($self);
    //@rmdir(litepublisher::$paths->data . 'posts');
}
function texternallinksUninstall($self)
{
    $filter = tcontentfilter::i();
    $filter->unbind($self);
    $cron = tcron::i();
    $cron->deleteclass(get_class($self));
    turlmap::unsub($self);
    if (dbversion) {
        $manager = tdbmanager::i();
        $manager->deletetable($self->table);
    }
    tposts::i()->addrevision();
}
Beispiel #5
0
function ExportPosts()
{
    global $wpdb, $from;
    $urlmap = turlmap::i();
    $urlmap->lock();
    $posts = tposts::i();
    $posts->lock();
    if (dbversion) {
        $r = $wpdb->get_results("SELECT max(ID) as autoid FROM {$wpdb->posts} ");
        $autoid = (int) $r[0]->autoid;
        echo "{$autoid} = auto id posts\n";
        $posts->db->exec(sprintf('ALTER TABLE %s AUTO_INCREMENT = %d', $posts->thistable, $autoid));
    }
    $categories = tcategories::i();
    $categories->loadall();
    $categories->lock();
    $tags = ttags::i();
    $tags->loadall();
    $tags->lock();
    if ($from == 0) {
        echo "import categories\n";
        ExportCategories();
        echo "import pages\n";
        ExportPages();
    }
    $cron = tcron::i();
    $cron->disableadd = true;
    //$list = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type = 'post'");
    $list = $wpdb->get_results("SELECT ID FROM {$wpdb->posts} \r\nWHERE post_type = 'post'\r\nand ID > {$from}\r\nlimit 500\r\n");
    echo count($list), " = countposts\n";
    foreach ($list as $index => $idresult) {
        //$itemres= $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE ID = $idresult");
        $itemres = $wpdb->get_results("SELECT * FROM {$wpdb->posts} WHERE ID = {$idresult->ID}");
        $item =& $itemres[0];
        $post = new tpost();
        $post->id = (int) $item->ID;
        echo $post->id, " = id post\n";
        $post->posted = strtotime(mysql2date('Ymd\\TH:i:s', $item->post_date));
        $post->title = $item->post_title;
        $post->categories = wp_get_post_categories($item->ID);
        $taglist = array();
        $wptags = wp_get_post_tags($item->ID);
        foreach ($wptags as $wptag) {
            AddTag($tags, (int) $wptag->term_id, 0, $wptag->name, get_tag_link($wptag->term_id));
            $taglist[] = (int) $wptag->term_id;
        }
        $post->tags = $taglist;
        $UrlArray = parse_url(@get_permalink($item->ID));
        $url = $UrlArray['path'];
        if (!empty($UrlArray['query'])) {
            $url .= '?' . $UrlArray['query'];
        }
        $post->url = $url;
        $post->idurl = litepublisher::$urlmap->add($post->url, get_class($post), $post->id);
        $post->content = $item->post_content;
        $post->commentsenabled = 'open' == $item->comment_status;
        $post->pingenabled = 'open' == $item->ping_status;
        $post->password = $item->post_password;
        $post->status = $item->post_status == 'publish' ? 'published' : 'draft';
        savepost($post);
        $categories->itemsposts->setitems($post->id, $post->categories);
        $tags->itemsposts->setitems($post->id, $post->tags);
        ExportComments($post);
        $post->free();
    }
    $cron->unlock();
    //$CommentManager->SubscribtionEnabled = true;
    //$CommentManager->NotifyModerator = true;
    $tags->unlock();
    $categories->unlock();
    $posts->UpdateArchives();
    $posts->addrevision();
    $posts->unlock();
    $urlmap->clearcache();
    $arch = tarchives::i();
    $arch->postschanged();
    $urlmap->unlock();
    if (count($list) < 500) {
        return false;
    }
    return $item->ID;
}
Beispiel #6
0
 public static function pingonshutdown()
 {
     if (self::$pinged) {
         return;
     }
     self::$pinged = true;
     if (tfilestorage::$memcache) {
         $memcache = tfilestorage::$memcache;
         $k = litepublisher::$domain . ':lastpinged';
         $memcache->set($k, time(), false, 3600);
         $k = litepublisher::$domain . ':singlepinged';
         $memcache->delete($k);
     }
     register_shutdown_function(array(tcron::i(), 'ping'));
 }
Beispiel #7
0
<?php

Header('Cache-Control: no-cache, must-revalidate');
Header('Pragma: no-cache');
error_reporting(E_ALL | E_NOTICE | E_STRICT | E_WARNING);
ini_set('display_errors', 1);
define('litepublisher_mode', 'xmlrpc');
include 'index.php';
litepublisher::$debug = true;
$cron = tcron::i();
$_GET['cronpass'] = $cron->password;
echo "<pre>\nmustbe start<br>";
flush();
var_dump($cron->request(null));
echo "finish";
Beispiel #8
0
 protected function close()
 {
     $this->call_close_events();
     if ($this->disabledcron) {
         return;
     }
     if (tfilestorage::$memcache) {
         $memcache = tfilestorage::$memcache;
         $k = litepublisher::$domain . ':lastpinged';
         $lastpinged = $memcache->get($k);
         if (!$lastpinged || time() > $lastpinged + 3600) {
             $memcache->set($k, time(), false, 3600);
             tcron::pingonshutdown();
         } else {
             $k = litepublisher::$domain . ':singlepinged';
             $singlepinged = $memcache->get($k);
             if ($singlepinged && time() > $singlepinged + 300) {
                 $memcache->delete($k);
                 tcron::pingonshutdown();
             }
         }
     } elseif (time() > litepublisher::$options->crontime + 3600) {
         litepublisher::$options->crontime = time();
         tcron::pingonshutdown();
     }
 }
function tbackup2emailUninstall($self)
{
    tcron::i()->deleteclass($self);
}
function tthemegeneratorUninstall($self)
{
    if ($self->id == 0) {
        if ($id = $self->getowner()->class2id(get_class($self))) {
            $self->loaddata($id);
        }
    }
    $views = tviews::instance();
    $views->delete($self->idview);
    $views->delete($self->leftview);
    $views->delete($self->rightview);
    $merger = tlocalmerger::i();
    unset($merger->items['themegenerator']);
    $merger->save();
    $js = tjsmerger::i();
    unset($js->items['themegenerator']);
    $js->save();
    $template = ttemplate::i();
    unset($template->data['jsmerger_themegenerator']);
    $template->save();
    tcron::i()->unbind($self);
    $menus = tmenus::i();
    $menus->deletetree($self->id);
    tfiler::delete(litepublisher::$paths->files . 'themegen', true, true);
}
 public function sendmail($id)
 {
     if (!$this->enabled) {
         return;
     }
     $comments = tcomments::i();
     if (!$comments->itemexists($id)) {
         return;
     }
     $item = $comments->getitem($id);
     if ($item['status'] != 'approved') {
         return;
     }
     if (litepublisher::$options->mailer == 'smtp') {
         tcron::i()->add('single', get_class($this), 'cronsendmail', (int) $id);
     } else {
         $this->cronsendmail($id);
     }
 }
Beispiel #12
0
 public function updated(tpost $post)
 {
     $this->PublishFuture();
     $this->UpdateArchives();
     tcron::i()->add('single', get_class($this), 'dosinglecron', $post->id);
 }
function tfoafutilUninstall($self)
{
    $cron = tcron::i();
    $cron->deleteclass(get_class($self));
}
function tbackup2dropboxUninstall($self)
{
    tcron::i()->delete($self->idcron);
}
function tdownloaditemcounterUninstall($self)
{
    $cron = tcron::i();
    $cron->deleteclass(get_class($self));
    turlmap::unsub($self);
}
Beispiel #16
0
<?php

define('litepublisher_mode', 'cron');
include 'index.php';
$cron = tcron::instance();
$_GET['cronpass'] = $cron->password;
$cron->request(null);
echo "finish";