Skip to content

Issues-519: made service files executable #546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,9 @@ RUN echo 'deb https://packages.tideways.com/apt-packages debian main' > /etc/apt
# Copy custom supervisor's configs and scripts
# Netcat is used to connect to a memcached server
RUN apt-get update && apt-get install -y netcat
COPY ./services /opt/docker/etc/supervisor.d/
COPY ./services /opt/docker/bin/service.d/
COPY ./services/*.conf /opt/docker/etc/supervisor.d/
COPY ./services/*.sh /opt/docker/bin/service.d/

# Ensure the service files are already executable
RUN chmod +x /opt/docker/bin/service.d/flush_cache.sh
RUN chmod +x /opt/docker/bin/service.d/tideways.sh
4 changes: 2 additions & 2 deletions services/tideways.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ priority=10
command=/opt/docker/bin/service.d/tideways.sh
process_name=%(program_name)s
startsecs=0
startretries=0
startretries=3
autostart=true
autorestart=false
autorestart=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,21 @@ private function getCategoryTree($category = null, $displayAs = null, $recent =
case 'Default':
case 'Nested':
default:
$categoryTree = $this->CategoryModel
->setJoinUserCategory(true)
->getChildTree(
$categoryIdentifier ?: null,
['depth' => CategoryModel::instance()->getMaxDisplayDepth() ?: 10]
);
// FIX: https://github.com/topcoder-platform/forums/issues/487
if( $categoryIdentifier != -1 && $categoryIdentifier != null) {
$categoryTree = $this->CategoryModel
->setJoinUserCategory(true)
->getChildTree(
$categoryIdentifier,
['depth' => CategoryModel::instance()->getMaxDisplayDepth() ?: 10]
);
} else {
$categoryTree = $this->CategoryModel
->setJoinUserCategory(true)
->getChildTree(-1, ['maxdepth' => 3,
'collapsecategories' => false,
'permission' => 'PermsDiscussionsView']);
}
}

if ($recent) {
Expand Down Expand Up @@ -293,6 +302,9 @@ public function index($categoryIdentifier = '', $page = '0') {
$this->setData('CategorySort', $sort);

if ($categoryIdentifier == '') {
// Add jquery-accordion ui
$this->addJsFile('jquery-ui-1.10.0.custom.min.js');
$this->addJsFile('home.js');
$this->fireEvent('EnableFollowingFilter', [
'CategoryIdentifier' => $categoryIdentifier,
'EnableFollowingFilter' => &$this->enableFollowingFilter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ public function index($DiscussionID = '', $DiscussionStub = '', $Page = '') {
Gdn_Theme::section($CategoryCssClass);
}

$this->setData('Breadcrumbs', $this->buildBreadcrumbs($this->CategoryID));
$ancestors = $this->buildBreadcrumbs($this->CategoryID);
array_push($ancestors, ['Name' => $this->Discussion->Name]);

$this->setData('Breadcrumbs', $ancestors);

// Setup
$this->title($this->Discussion->Name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ protected function buildBreadcrumbs($CategoryID) {
}
}

array_unshift($ancestors, self::ROOT_CATEGORY);
return $ancestors;
}
}
Expand Down
8 changes: 8 additions & 0 deletions vanilla/applications/vanilla/js/home.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
jQuery(document).ready(function($) {
$(".CategoryAccordion").accordion({ header: ".CategoryAccordionHeader",
animate:false,
collapsible: true,
active: 0, heightStyle: "content" ,
icons: { "header": "icon icon-chevron-down", "activeHeader": "icon icon-chevron-up" }});

});
6 changes: 5 additions & 1 deletion vanilla/applications/vanilla/views/categories/all.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@
}
echo '</div>';
$categories = $this->data('CategoryTree');
writeCategoryList($categories, 1);
if(!is_null($this->Category)) {
writeCategoryList($categories, 1);
} else {
writeCategoryAccordion($categories, 1);
}
62 changes: 62 additions & 0 deletions vanilla/applications/vanilla/views/categories/helper_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,68 @@ function writeTableRow($row, $depth = 1) {
}
endif;

if (!function_exists('writeCategoryAccordion')):
/**
* Renders a category list (modern view).
*
* @param $categories
* @param int $depth
*/
function writeCategoryAccordion($categories, $depth = 1) {
if (empty($categories)) {
echo '<div class="Empty">'.t('No categories were found.').'</div>';
return;
}

?>
<div class="DataListWrap DataAccordionWrap">
<div id="CategoryAccordion" class="CategoryAccordion">
<?php
foreach ($categories as $category) {
writeAccordionItem($category, $depth);
}
?>
</div>
</div>
<?php
}
endif;

if (!function_exists('writeAccordionItem')):
/**
* Renders a accordion item in a category list (modern view).
*
* @param $category
* @param $depth
* @throws Exception
*/
function writeAccordionItem($category, $depth) {
$urlcode = $category['UrlCode'];
// FIX: https://github.com/topcoder-platform/forums/issues/477: Don't show 'Challenge Forums'
if($urlcode == VanillaController::CHALLENGE_FORUMS_URLCODE) {
return;
}
$children = val('Children',$category);
$categoryID = val('CategoryID', $category);
$cssClass = cssClass($category, true);
?>
<div id="Category_<?php echo $categoryID; ?>" class="CategoryAccordionItem">
<div class="<?php echo $cssClass; ?> CategoryAccordionHeader">
<a class="toggle" href="javascript:void(0);"><?php echo Gdn_Format::text(val('Name', $category)); ?></a>
</div>
<ul id="Category_<?php echo $categoryID; ?>_child" class="DataList CategoryList CategoryAccordionCollapse">
<?php
foreach ($children as $child) {
writeListItem($child, $depth + 1);
}
?>
</ul>
</div>

<?php
}
endif;

if (!function_exists('writeCategoryList')):
/**
* Renders a category list (modern view).
Expand Down