Example #1
0
File: sitemap.php Project: rjha/sc
function create_groups_map($mysqli)
{
    $xml = '<?xml version="1.0" encoding="UTF-8"?> ';
    $xml .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">  </urlset>';
    $xmlDoc = new SimpleXMLElement($xml);
    //get 5000 latest groups
    $lastId = 0;
    for ($page = 1; $page <= 50; $page++) {
        if ($page == 1) {
            $rows = \com\indigloo\sc\mysql\Group::getLatest(100, array());
        } else {
            $start = $lastId;
            $direction = 'after';
            $rows = \com\indigloo\sc\mysql\Group::getPaged($start, $direction, 100, array());
        }
        foreach ($rows as $row) {
            $loc = "http://www.3mik.com/group/%s";
            $loc = sprintf($loc, $row['token']);
            $urlNode = $xmlDoc->addChild('url');
            $urlNode->addChild('loc', $loc);
            //last modified date is max(created_on,updated_on)
            $urlNode->addChild('lastmod', date('Y-m-d'));
            $lastId = $row['id'];
        }
    }
    $xmlString = $xmlDoc->asXML();
    write_on_disk('sitemap_groups.xml', $xmlString);
}
Example #2
0
File: Group.php Project: rjha/sc
 function process($postId)
 {
     $postDao = new \com\indigloo\sc\dao\Post();
     $postDBRow = $postDao->getonId($postId);
     $group_slug = $postDBRow['group_slug'];
     $version = $postDBRow['version'];
     $catCode = $postDBRow['cat_code'];
     $loginId = $postDBRow['login_id'];
     mysql\Group::process($postId, $loginId, $version, $catCode, $group_slug);
 }