1
0
mirror of https://github.com/e107inc/e107.git synced 2025-03-14 01:19:44 +01:00

Merge pull request #4114 from e107inc/build-release

Automated Release Builds
This commit is contained in:
Cameron 2020-03-28 15:30:04 -07:00 committed by GitHub
commit 4e78b5e1ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 3303 additions and 1039 deletions

View File

@ -1,10 +1,801 @@
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
[*.php]
indent_style = tab
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = false
max_line_length = 120
tab_width = 4
ij_continuation_indent_size = 8
ij_formatter_off_tag = @formatter:off
ij_formatter_on_tag = @formatter:on
ij_formatter_tags_enabled = false
ij_smart_tabs = false
ij_wrap_on_typing = false
[*.blade.php]
ij_blade_keep_indents_on_empty_lines = false
[*.css]
ij_css_align_closing_brace_with_properties = false
ij_css_blank_lines_around_nested_selector = 1
ij_css_blank_lines_between_blocks = 1
ij_css_brace_placement = 0
ij_css_enforce_quotes_on_format = false
ij_css_hex_color_long_format = false
ij_css_hex_color_lower_case = false
ij_css_hex_color_short_format = false
ij_css_hex_color_upper_case = false
ij_css_keep_blank_lines_in_code = 2
ij_css_keep_indents_on_empty_lines = false
ij_css_keep_single_line_blocks = false
ij_css_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow
ij_css_space_after_colon = true
ij_css_space_before_opening_brace = true
ij_css_use_double_quotes = true
ij_css_value_alignment = 0
[*.feature]
indent_size = 2
ij_gherkin_keep_indents_on_empty_lines = false
[*.haml]
indent_size = 2
ij_haml_keep_indents_on_empty_lines = false
[*.less]
indent_size = 2
ij_less_align_closing_brace_with_properties = false
ij_less_blank_lines_around_nested_selector = 1
ij_less_blank_lines_between_blocks = 1
ij_less_brace_placement = 0
ij_less_enforce_quotes_on_format = false
ij_less_hex_color_long_format = false
ij_less_hex_color_lower_case = false
ij_less_hex_color_short_format = false
ij_less_hex_color_upper_case = false
ij_less_keep_blank_lines_in_code = 2
ij_less_keep_indents_on_empty_lines = false
ij_less_keep_single_line_blocks = false
ij_less_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow
ij_less_space_after_colon = true
ij_less_space_before_opening_brace = true
ij_less_use_double_quotes = true
ij_less_value_alignment = 0
[*.sass]
indent_size = 2
ij_sass_align_closing_brace_with_properties = false
ij_sass_blank_lines_around_nested_selector = 1
ij_sass_blank_lines_between_blocks = 1
ij_sass_brace_placement = 0
ij_sass_enforce_quotes_on_format = false
ij_sass_hex_color_long_format = false
ij_sass_hex_color_lower_case = false
ij_sass_hex_color_short_format = false
ij_sass_hex_color_upper_case = false
ij_sass_keep_blank_lines_in_code = 2
ij_sass_keep_indents_on_empty_lines = false
ij_sass_keep_single_line_blocks = false
ij_sass_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow
ij_sass_space_after_colon = true
ij_sass_space_before_opening_brace = true
ij_sass_use_double_quotes = true
ij_sass_value_alignment = 0
[*.scss]
indent_size = 2
ij_scss_align_closing_brace_with_properties = false
ij_scss_blank_lines_around_nested_selector = 1
ij_scss_blank_lines_between_blocks = 1
ij_scss_brace_placement = 0
ij_scss_enforce_quotes_on_format = false
ij_scss_hex_color_long_format = false
ij_scss_hex_color_lower_case = false
ij_scss_hex_color_short_format = false
ij_scss_hex_color_upper_case = false
ij_scss_keep_blank_lines_in_code = 2
ij_scss_keep_indents_on_empty_lines = false
ij_scss_keep_single_line_blocks = false
ij_scss_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow
ij_scss_space_after_colon = true
ij_scss_space_before_opening_brace = true
ij_scss_use_double_quotes = true
ij_scss_value_alignment = 0
[*.twig]
ij_twig_keep_indents_on_empty_lines = false
ij_twig_spaces_inside_delimiters = true
ij_twig_spaces_inside_variable_delimiters = true
[.editorconfig]
ij_editorconfig_align_group_field_declarations = false
ij_editorconfig_space_after_colon = false
ij_editorconfig_space_after_comma = true
ij_editorconfig_space_before_colon = false
ij_editorconfig_space_before_comma = false
ij_editorconfig_spaces_around_assignment_operators = true
[{*.bash,*.zsh,*.sh}]
indent_size = 2
tab_width = 2
ij_shell_binary_ops_start_line = false
ij_shell_keep_column_alignment_padding = false
ij_shell_minify_program = false
ij_shell_redirect_followed_by_space = false
ij_shell_switch_cases_indented = false
[{*.cjs,*.js}]
ij_continuation_indent_size = 4
ij_javascript_align_imports = false
ij_javascript_align_multiline_array_initializer_expression = false
ij_javascript_align_multiline_binary_operation = false
ij_javascript_align_multiline_chained_methods = false
ij_javascript_align_multiline_extends_list = false
ij_javascript_align_multiline_for = true
ij_javascript_align_multiline_parameters = true
ij_javascript_align_multiline_parameters_in_calls = false
ij_javascript_align_multiline_ternary_operation = false
ij_javascript_align_object_properties = 0
ij_javascript_align_union_types = false
ij_javascript_align_var_statements = 0
ij_javascript_array_initializer_new_line_after_left_brace = false
ij_javascript_array_initializer_right_brace_on_new_line = false
ij_javascript_array_initializer_wrap = off
ij_javascript_assignment_wrap = off
ij_javascript_binary_operation_sign_on_next_line = false
ij_javascript_binary_operation_wrap = off
ij_javascript_blacklist_imports = rxjs/Rx,node_modules/**/*,@angular/material,@angular/material/typings/**,~/node_modules/**/*,@/node_modules/**/*
ij_javascript_blank_lines_after_imports = 1
ij_javascript_blank_lines_around_class = 1
ij_javascript_blank_lines_around_field = 0
ij_javascript_blank_lines_around_function = 1
ij_javascript_blank_lines_around_method = 1
ij_javascript_block_brace_style = end_of_line
ij_javascript_call_parameters_new_line_after_left_paren = false
ij_javascript_call_parameters_right_paren_on_new_line = false
ij_javascript_call_parameters_wrap = off
ij_javascript_catch_on_new_line = false
ij_javascript_chained_call_dot_on_new_line = true
ij_javascript_class_brace_style = end_of_line
ij_javascript_comma_on_new_line = false
ij_javascript_do_while_brace_force = never
ij_javascript_else_on_new_line = false
ij_javascript_enforce_trailing_comma = keep
ij_javascript_extends_keyword_wrap = off
ij_javascript_extends_list_wrap = off
ij_javascript_field_prefix = _
ij_javascript_file_name_style = relaxed
ij_javascript_finally_on_new_line = false
ij_javascript_for_brace_force = never
ij_javascript_for_statement_new_line_after_left_paren = false
ij_javascript_for_statement_right_paren_on_new_line = false
ij_javascript_for_statement_wrap = off
ij_javascript_force_quote_style = false
ij_javascript_force_semicolon_style = false
ij_javascript_function_expression_brace_style = end_of_line
ij_javascript_if_brace_force = never
ij_javascript_import_merge_members = global
ij_javascript_import_prefer_absolute_path = global
ij_javascript_import_sort_members = true
ij_javascript_import_sort_module_name = false
ij_javascript_import_use_node_resolution = true
ij_javascript_imports_wrap = on_every_item
ij_javascript_indent_case_from_switch = true
ij_javascript_indent_chained_calls = true
ij_javascript_indent_package_children = 0
ij_javascript_jsx_attribute_value = braces
ij_javascript_keep_blank_lines_in_code = 2
ij_javascript_keep_first_column_comment = true
ij_javascript_keep_indents_on_empty_lines = false
ij_javascript_keep_line_breaks = true
ij_javascript_keep_simple_blocks_in_one_line = false
ij_javascript_keep_simple_methods_in_one_line = false
ij_javascript_line_comment_add_space = true
ij_javascript_line_comment_at_first_column = false
ij_javascript_method_brace_style = end_of_line
ij_javascript_method_call_chain_wrap = off
ij_javascript_method_parameters_new_line_after_left_paren = false
ij_javascript_method_parameters_right_paren_on_new_line = false
ij_javascript_method_parameters_wrap = off
ij_javascript_object_literal_wrap = on_every_item
ij_javascript_parentheses_expression_new_line_after_left_paren = false
ij_javascript_parentheses_expression_right_paren_on_new_line = false
ij_javascript_place_assignment_sign_on_next_line = false
ij_javascript_prefer_as_type_cast = false
ij_javascript_prefer_parameters_wrap = false
ij_javascript_reformat_c_style_comments = false
ij_javascript_space_after_colon = true
ij_javascript_space_after_comma = true
ij_javascript_space_after_dots_in_rest_parameter = false
ij_javascript_space_after_generator_mult = true
ij_javascript_space_after_property_colon = true
ij_javascript_space_after_quest = true
ij_javascript_space_after_type_colon = true
ij_javascript_space_after_unary_not = false
ij_javascript_space_before_async_arrow_lparen = true
ij_javascript_space_before_catch_keyword = true
ij_javascript_space_before_catch_left_brace = true
ij_javascript_space_before_catch_parentheses = true
ij_javascript_space_before_class_lbrace = true
ij_javascript_space_before_class_left_brace = true
ij_javascript_space_before_colon = true
ij_javascript_space_before_comma = false
ij_javascript_space_before_do_left_brace = true
ij_javascript_space_before_else_keyword = true
ij_javascript_space_before_else_left_brace = true
ij_javascript_space_before_finally_keyword = true
ij_javascript_space_before_finally_left_brace = true
ij_javascript_space_before_for_left_brace = true
ij_javascript_space_before_for_parentheses = true
ij_javascript_space_before_for_semicolon = false
ij_javascript_space_before_function_left_parenth = true
ij_javascript_space_before_generator_mult = false
ij_javascript_space_before_if_left_brace = true
ij_javascript_space_before_if_parentheses = true
ij_javascript_space_before_method_call_parentheses = false
ij_javascript_space_before_method_left_brace = true
ij_javascript_space_before_method_parentheses = false
ij_javascript_space_before_property_colon = false
ij_javascript_space_before_quest = true
ij_javascript_space_before_switch_left_brace = true
ij_javascript_space_before_switch_parentheses = true
ij_javascript_space_before_try_left_brace = true
ij_javascript_space_before_type_colon = false
ij_javascript_space_before_unary_not = false
ij_javascript_space_before_while_keyword = true
ij_javascript_space_before_while_left_brace = true
ij_javascript_space_before_while_parentheses = true
ij_javascript_spaces_around_additive_operators = true
ij_javascript_spaces_around_arrow_function_operator = true
ij_javascript_spaces_around_assignment_operators = true
ij_javascript_spaces_around_bitwise_operators = true
ij_javascript_spaces_around_equality_operators = true
ij_javascript_spaces_around_logical_operators = true
ij_javascript_spaces_around_multiplicative_operators = true
ij_javascript_spaces_around_relational_operators = true
ij_javascript_spaces_around_shift_operators = true
ij_javascript_spaces_around_unary_operator = false
ij_javascript_spaces_within_array_initializer_brackets = false
ij_javascript_spaces_within_brackets = false
ij_javascript_spaces_within_catch_parentheses = false
ij_javascript_spaces_within_for_parentheses = false
ij_javascript_spaces_within_if_parentheses = false
ij_javascript_spaces_within_imports = false
ij_javascript_spaces_within_interpolation_expressions = false
ij_javascript_spaces_within_method_call_parentheses = false
ij_javascript_spaces_within_method_parentheses = false
ij_javascript_spaces_within_object_literal_braces = false
ij_javascript_spaces_within_object_type_braces = true
ij_javascript_spaces_within_parentheses = false
ij_javascript_spaces_within_switch_parentheses = false
ij_javascript_spaces_within_type_assertion = false
ij_javascript_spaces_within_union_types = true
ij_javascript_spaces_within_while_parentheses = false
ij_javascript_special_else_if_treatment = true
ij_javascript_ternary_operation_signs_on_next_line = false
ij_javascript_ternary_operation_wrap = off
ij_javascript_union_types_wrap = on_every_item
ij_javascript_use_chained_calls_group_indents = false
ij_javascript_use_double_quotes = true
ij_javascript_use_explicit_js_extension = global
ij_javascript_use_path_mapping = always
ij_javascript_use_public_modifier = false
ij_javascript_use_semicolon_after_statement = true
ij_javascript_var_declaration_wrap = normal
ij_javascript_while_brace_force = never
ij_javascript_while_on_new_line = false
ij_javascript_wrap_comments = false
[{*.cjsx,*.coffee}]
indent_size = 2
tab_width = 2
ij_continuation_indent_size = 2
ij_coffeescript_align_function_body = false
ij_coffeescript_align_imports = false
ij_coffeescript_align_multiline_array_initializer_expression = true
ij_coffeescript_align_multiline_parameters = true
ij_coffeescript_align_multiline_parameters_in_calls = false
ij_coffeescript_align_object_properties = 0
ij_coffeescript_align_union_types = false
ij_coffeescript_align_var_statements = 0
ij_coffeescript_array_initializer_new_line_after_left_brace = false
ij_coffeescript_array_initializer_right_brace_on_new_line = false
ij_coffeescript_array_initializer_wrap = normal
ij_coffeescript_blacklist_imports = rxjs/Rx,node_modules/**/*,@angular/material,@angular/material/typings/**,~/node_modules/**/*,@/node_modules/**/*
ij_coffeescript_blank_lines_around_function = 1
ij_coffeescript_call_parameters_new_line_after_left_paren = false
ij_coffeescript_call_parameters_right_paren_on_new_line = false
ij_coffeescript_call_parameters_wrap = normal
ij_coffeescript_chained_call_dot_on_new_line = true
ij_coffeescript_comma_on_new_line = false
ij_coffeescript_enforce_trailing_comma = keep
ij_coffeescript_field_prefix = _
ij_coffeescript_file_name_style = relaxed
ij_coffeescript_force_quote_style = false
ij_coffeescript_force_semicolon_style = false
ij_coffeescript_function_expression_brace_style = end_of_line
ij_coffeescript_import_merge_members = global
ij_coffeescript_import_prefer_absolute_path = global
ij_coffeescript_import_sort_members = true
ij_coffeescript_import_sort_module_name = false
ij_coffeescript_import_use_node_resolution = true
ij_coffeescript_imports_wrap = on_every_item
ij_coffeescript_indent_chained_calls = true
ij_coffeescript_indent_package_children = 0
ij_coffeescript_jsx_attribute_value = braces
ij_coffeescript_keep_blank_lines_in_code = 2
ij_coffeescript_keep_first_column_comment = true
ij_coffeescript_keep_indents_on_empty_lines = false
ij_coffeescript_keep_line_breaks = true
ij_coffeescript_keep_simple_methods_in_one_line = false
ij_coffeescript_method_parameters_new_line_after_left_paren = false
ij_coffeescript_method_parameters_right_paren_on_new_line = false
ij_coffeescript_method_parameters_wrap = off
ij_coffeescript_object_literal_wrap = on_every_item
ij_coffeescript_prefer_as_type_cast = false
ij_coffeescript_reformat_c_style_comments = false
ij_coffeescript_space_after_comma = true
ij_coffeescript_space_after_dots_in_rest_parameter = false
ij_coffeescript_space_after_generator_mult = true
ij_coffeescript_space_after_property_colon = true
ij_coffeescript_space_after_type_colon = true
ij_coffeescript_space_after_unary_not = false
ij_coffeescript_space_before_async_arrow_lparen = true
ij_coffeescript_space_before_class_lbrace = true
ij_coffeescript_space_before_comma = false
ij_coffeescript_space_before_function_left_parenth = true
ij_coffeescript_space_before_generator_mult = false
ij_coffeescript_space_before_property_colon = false
ij_coffeescript_space_before_type_colon = false
ij_coffeescript_space_before_unary_not = false
ij_coffeescript_spaces_around_additive_operators = true
ij_coffeescript_spaces_around_arrow_function_operator = true
ij_coffeescript_spaces_around_assignment_operators = true
ij_coffeescript_spaces_around_bitwise_operators = true
ij_coffeescript_spaces_around_equality_operators = true
ij_coffeescript_spaces_around_logical_operators = true
ij_coffeescript_spaces_around_multiplicative_operators = true
ij_coffeescript_spaces_around_relational_operators = true
ij_coffeescript_spaces_around_shift_operators = true
ij_coffeescript_spaces_around_unary_operator = false
ij_coffeescript_spaces_within_array_initializer_braces = false
ij_coffeescript_spaces_within_array_initializer_brackets = false
ij_coffeescript_spaces_within_imports = false
ij_coffeescript_spaces_within_index_brackets = false
ij_coffeescript_spaces_within_interpolation_expressions = false
ij_coffeescript_spaces_within_method_call_parentheses = false
ij_coffeescript_spaces_within_method_parentheses = false
ij_coffeescript_spaces_within_object_braces = false
ij_coffeescript_spaces_within_object_literal_braces = false
ij_coffeescript_spaces_within_object_type_braces = true
ij_coffeescript_spaces_within_range_brackets = false
ij_coffeescript_spaces_within_type_assertion = false
ij_coffeescript_spaces_within_union_types = true
ij_coffeescript_union_types_wrap = on_every_item
ij_coffeescript_use_chained_calls_group_indents = false
ij_coffeescript_use_double_quotes = true
ij_coffeescript_use_explicit_js_extension = global
ij_coffeescript_use_path_mapping = always
ij_coffeescript_use_public_modifier = false
ij_coffeescript_use_semicolon_after_statement = false
ij_coffeescript_var_declaration_wrap = normal
[{*.ctp,*.hphp,*.phtml,*.module,*.php,*.php5,*.php4,*.inc}]
ij_continuation_indent_size = 4
ij_php_align_assignments = false
ij_php_align_class_constants = false
ij_php_align_group_field_declarations = false
ij_php_align_inline_comments = false
ij_php_align_key_value_pairs = false
ij_php_align_multiline_array_initializer_expression = false
ij_php_align_multiline_binary_operation = false
ij_php_align_multiline_chained_methods = false
ij_php_align_multiline_extends_list = false
ij_php_align_multiline_for = true
ij_php_align_multiline_parameters = true
ij_php_align_multiline_parameters_in_calls = false
ij_php_align_multiline_ternary_operation = false
ij_php_align_phpdoc_comments = false
ij_php_align_phpdoc_param_names = false
ij_php_anonymous_brace_style = next_line
ij_php_api_weight = 28
ij_php_array_initializer_new_line_after_left_brace = false
ij_php_array_initializer_right_brace_on_new_line = false
ij_php_array_initializer_wrap = off
ij_php_assignment_wrap = off
ij_php_author_weight = 28
ij_php_binary_operation_sign_on_next_line = false
ij_php_binary_operation_wrap = off
ij_php_blank_lines_after_class_header = 0
ij_php_blank_lines_after_function = 1
ij_php_blank_lines_after_imports = 1
ij_php_blank_lines_after_opening_tag = 0
ij_php_blank_lines_after_package = 0
ij_php_blank_lines_around_class = 1
ij_php_blank_lines_around_constants = 0
ij_php_blank_lines_around_field = 0
ij_php_blank_lines_around_method = 1
ij_php_blank_lines_before_class_end = 0
ij_php_blank_lines_before_imports = 1
ij_php_blank_lines_before_method_body = 0
ij_php_blank_lines_before_package = 1
ij_php_blank_lines_before_return_statement = 0
ij_php_blank_lines_between_imports = 0
ij_php_block_brace_style = next_line
ij_php_call_parameters_new_line_after_left_paren = false
ij_php_call_parameters_right_paren_on_new_line = false
ij_php_call_parameters_wrap = off
ij_php_catch_on_new_line = true
ij_php_category_weight = 28
ij_php_class_brace_style = next_line
ij_php_comma_after_last_array_element = false
ij_php_concat_spaces = true
ij_php_copyright_weight = 28
ij_php_deprecated_weight = 28
ij_php_do_while_brace_force = never
ij_php_else_if_style = as_is
ij_php_else_on_new_line = true
ij_php_example_weight = 28
ij_php_extends_keyword_wrap = off
ij_php_extends_list_wrap = off
ij_php_fields_default_visibility = private
ij_php_filesource_weight = 28
ij_php_finally_on_new_line = true
ij_php_for_brace_force = never
ij_php_for_statement_new_line_after_left_paren = false
ij_php_for_statement_right_paren_on_new_line = false
ij_php_for_statement_wrap = off
ij_php_force_short_declaration_array_style = false
ij_php_global_weight = 28
ij_php_group_use_wrap = on_every_item
ij_php_if_brace_force = never
ij_php_if_lparen_on_next_line = false
ij_php_if_rparen_on_next_line = false
ij_php_ignore_weight = 28
ij_php_import_sorting = alphabetic
ij_php_indent_break_from_case = true
ij_php_indent_case_from_switch = true
ij_php_indent_code_in_php_tags = false
ij_php_internal_weight = 28
ij_php_keep_blank_lines_after_lbrace = 2
ij_php_keep_blank_lines_before_right_brace = 2
ij_php_keep_blank_lines_in_code = 2
ij_php_keep_blank_lines_in_declarations = 2
ij_php_keep_control_statement_in_one_line = true
ij_php_keep_first_column_comment = true
ij_php_keep_indents_on_empty_lines = false
ij_php_keep_line_breaks = true
ij_php_keep_rparen_and_lbrace_on_one_line = false
ij_php_keep_simple_methods_in_one_line = false
ij_php_lambda_brace_style = next_line
ij_php_license_weight = 28
ij_php_line_comment_add_space = false
ij_php_line_comment_at_first_column = true
ij_php_link_weight = 28
ij_php_lower_case_boolean_const = false
ij_php_lower_case_null_const = false
ij_php_method_brace_style = next_line
ij_php_method_call_chain_wrap = off
ij_php_method_parameters_new_line_after_left_paren = false
ij_php_method_parameters_right_paren_on_new_line = false
ij_php_method_parameters_wrap = off
ij_php_method_weight = 28
ij_php_modifier_list_wrap = false
ij_php_multiline_chained_calls_semicolon_on_new_line = false
ij_php_namespace_brace_style = 2
ij_php_null_type_position = in_the_end
ij_php_package_weight = 28
ij_php_param_weight = 0
ij_php_parentheses_expression_new_line_after_left_paren = false
ij_php_parentheses_expression_right_paren_on_new_line = false
ij_php_phpdoc_blank_line_before_tags = false
ij_php_phpdoc_blank_lines_around_parameters = false
ij_php_phpdoc_keep_blank_lines = true
ij_php_phpdoc_param_spaces_between_name_and_description = 1
ij_php_phpdoc_param_spaces_between_tag_and_type = 1
ij_php_phpdoc_param_spaces_between_type_and_name = 1
ij_php_phpdoc_use_fqcn = false
ij_php_phpdoc_wrap_long_lines = false
ij_php_place_assignment_sign_on_next_line = false
ij_php_place_parens_for_constructor = 0
ij_php_property_read_weight = 28
ij_php_property_weight = 28
ij_php_property_write_weight = 28
ij_php_return_type_on_new_line = false
ij_php_return_weight = 1
ij_php_see_weight = 28
ij_php_since_weight = 28
ij_php_sort_phpdoc_elements = true
ij_php_space_after_colon = true
ij_php_space_after_colon_in_return_type = true
ij_php_space_after_comma = true
ij_php_space_after_for_semicolon = true
ij_php_space_after_quest = true
ij_php_space_after_type_cast = false
ij_php_space_after_unary_not = false
ij_php_space_before_array_initializer_left_brace = false
ij_php_space_before_catch_keyword = true
ij_php_space_before_catch_left_brace = true
ij_php_space_before_catch_parentheses = true
ij_php_space_before_class_left_brace = true
ij_php_space_before_closure_left_parenthesis = true
ij_php_space_before_colon = true
ij_php_space_before_colon_in_return_type = false
ij_php_space_before_comma = false
ij_php_space_before_do_left_brace = true
ij_php_space_before_else_keyword = true
ij_php_space_before_else_left_brace = true
ij_php_space_before_finally_keyword = true
ij_php_space_before_finally_left_brace = true
ij_php_space_before_for_left_brace = true
ij_php_space_before_for_parentheses = true
ij_php_space_before_for_semicolon = false
ij_php_space_before_if_left_brace = true
ij_php_space_before_if_parentheses = true
ij_php_space_before_method_call_parentheses = false
ij_php_space_before_method_left_brace = true
ij_php_space_before_method_parentheses = false
ij_php_space_before_quest = true
ij_php_space_before_switch_left_brace = true
ij_php_space_before_switch_parentheses = true
ij_php_space_before_try_left_brace = true
ij_php_space_before_unary_not = false
ij_php_space_before_while_keyword = true
ij_php_space_before_while_left_brace = true
ij_php_space_before_while_parentheses = true
ij_php_space_between_ternary_quest_and_colon = false
ij_php_spaces_around_additive_operators = true
ij_php_spaces_around_arrow = false
ij_php_spaces_around_assignment_in_declare = false
ij_php_spaces_around_assignment_operators = true
ij_php_spaces_around_bitwise_operators = true
ij_php_spaces_around_equality_operators = true
ij_php_spaces_around_logical_operators = true
ij_php_spaces_around_multiplicative_operators = true
ij_php_spaces_around_null_coalesce_operator = true
ij_php_spaces_around_relational_operators = true
ij_php_spaces_around_shift_operators = true
ij_php_spaces_around_unary_operator = false
ij_php_spaces_around_var_within_brackets = false
ij_php_spaces_within_array_initializer_braces = false
ij_php_spaces_within_brackets = false
ij_php_spaces_within_catch_parentheses = false
ij_php_spaces_within_for_parentheses = false
ij_php_spaces_within_if_parentheses = false
ij_php_spaces_within_method_call_parentheses = false
ij_php_spaces_within_method_parentheses = false
ij_php_spaces_within_parentheses = false
ij_php_spaces_within_short_echo_tags = true
ij_php_spaces_within_switch_parentheses = false
ij_php_spaces_within_while_parentheses = false
ij_php_special_else_if_treatment = false
ij_php_subpackage_weight = 28
ij_php_ternary_operation_signs_on_next_line = false
ij_php_ternary_operation_wrap = off
ij_php_throws_weight = 2
ij_php_todo_weight = 28
ij_php_unknown_tag_weight = 28
ij_php_upper_case_boolean_const = false
ij_php_upper_case_null_const = false
ij_php_uses_weight = 28
ij_php_var_weight = 28
ij_php_variable_naming_style = mixed
ij_php_version_weight = 28
ij_php_while_brace_force = never
ij_php_while_on_new_line = false
[{*.ng,*.sht,*.html,*.shtm,*.shtml,*.htm}]
ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3
ij_html_align_attributes = true
ij_html_align_text = false
ij_html_attribute_wrap = normal
ij_html_block_comment_at_first_column = true
ij_html_do_not_align_children_of_min_lines = 0
ij_html_do_not_break_if_inline_tags = title,h1,h2,h3,h4,h5,h6,p
ij_html_do_not_indent_children_of_tags = html,body,thead,tbody,tfoot
ij_html_enforce_quotes = false
ij_html_inline_tags = a,abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,input,kbd,label,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var
ij_html_keep_blank_lines = 2
ij_html_keep_indents_on_empty_lines = false
ij_html_keep_line_breaks = true
ij_html_keep_line_breaks_in_text = true
ij_html_keep_whitespaces = false
ij_html_keep_whitespaces_inside = span,pre,textarea
ij_html_line_comment_at_first_column = true
ij_html_new_line_after_last_attribute = never
ij_html_new_line_before_first_attribute = never
ij_html_quote_style = double
ij_html_remove_new_line_before_tags = br
ij_html_space_after_tag_name = false
ij_html_space_around_equality_in_attribute = false
ij_html_space_inside_empty_tag = false
ij_html_text_wrap = normal
[{*.ts,*.ats}]
ij_continuation_indent_size = 4
ij_typescript_align_imports = false
ij_typescript_align_multiline_array_initializer_expression = false
ij_typescript_align_multiline_binary_operation = false
ij_typescript_align_multiline_chained_methods = false
ij_typescript_align_multiline_extends_list = false
ij_typescript_align_multiline_for = true
ij_typescript_align_multiline_parameters = true
ij_typescript_align_multiline_parameters_in_calls = false
ij_typescript_align_multiline_ternary_operation = false
ij_typescript_align_object_properties = 0
ij_typescript_align_union_types = false
ij_typescript_align_var_statements = 0
ij_typescript_array_initializer_new_line_after_left_brace = false
ij_typescript_array_initializer_right_brace_on_new_line = false
ij_typescript_array_initializer_wrap = off
ij_typescript_assignment_wrap = off
ij_typescript_binary_operation_sign_on_next_line = false
ij_typescript_binary_operation_wrap = off
ij_typescript_blacklist_imports = rxjs/Rx,node_modules/**/*,@angular/material,@angular/material/typings/**,~/node_modules/**/*,@/node_modules/**/*
ij_typescript_blank_lines_after_imports = 1
ij_typescript_blank_lines_around_class = 1
ij_typescript_blank_lines_around_field = 0
ij_typescript_blank_lines_around_field_in_interface = 0
ij_typescript_blank_lines_around_function = 1
ij_typescript_blank_lines_around_method = 1
ij_typescript_blank_lines_around_method_in_interface = 1
ij_typescript_block_brace_style = end_of_line
ij_typescript_call_parameters_new_line_after_left_paren = false
ij_typescript_call_parameters_right_paren_on_new_line = false
ij_typescript_call_parameters_wrap = off
ij_typescript_catch_on_new_line = false
ij_typescript_chained_call_dot_on_new_line = true
ij_typescript_class_brace_style = end_of_line
ij_typescript_comma_on_new_line = false
ij_typescript_do_while_brace_force = never
ij_typescript_else_on_new_line = false
ij_typescript_enforce_trailing_comma = keep
ij_typescript_extends_keyword_wrap = off
ij_typescript_extends_list_wrap = off
ij_typescript_field_prefix = _
ij_typescript_file_name_style = relaxed
ij_typescript_finally_on_new_line = false
ij_typescript_for_brace_force = never
ij_typescript_for_statement_new_line_after_left_paren = false
ij_typescript_for_statement_right_paren_on_new_line = false
ij_typescript_for_statement_wrap = off
ij_typescript_force_quote_style = false
ij_typescript_force_semicolon_style = false
ij_typescript_function_expression_brace_style = end_of_line
ij_typescript_if_brace_force = never
ij_typescript_import_merge_members = global
ij_typescript_import_prefer_absolute_path = global
ij_typescript_import_sort_members = true
ij_typescript_import_sort_module_name = false
ij_typescript_import_use_node_resolution = true
ij_typescript_imports_wrap = on_every_item
ij_typescript_indent_case_from_switch = true
ij_typescript_indent_chained_calls = true
ij_typescript_indent_package_children = 0
ij_typescript_jsdoc_include_types = false
ij_typescript_jsx_attribute_value = braces
ij_typescript_keep_blank_lines_in_code = 2
ij_typescript_keep_first_column_comment = true
ij_typescript_keep_indents_on_empty_lines = false
ij_typescript_keep_line_breaks = true
ij_typescript_keep_simple_blocks_in_one_line = false
ij_typescript_keep_simple_methods_in_one_line = false
ij_typescript_line_comment_add_space = true
ij_typescript_line_comment_at_first_column = false
ij_typescript_method_brace_style = end_of_line
ij_typescript_method_call_chain_wrap = off
ij_typescript_method_parameters_new_line_after_left_paren = false
ij_typescript_method_parameters_right_paren_on_new_line = false
ij_typescript_method_parameters_wrap = off
ij_typescript_object_literal_wrap = on_every_item
ij_typescript_parentheses_expression_new_line_after_left_paren = false
ij_typescript_parentheses_expression_right_paren_on_new_line = false
ij_typescript_place_assignment_sign_on_next_line = false
ij_typescript_prefer_as_type_cast = false
ij_typescript_prefer_parameters_wrap = false
ij_typescript_reformat_c_style_comments = false
ij_typescript_space_after_colon = true
ij_typescript_space_after_comma = true
ij_typescript_space_after_dots_in_rest_parameter = false
ij_typescript_space_after_generator_mult = true
ij_typescript_space_after_property_colon = true
ij_typescript_space_after_quest = true
ij_typescript_space_after_type_colon = true
ij_typescript_space_after_unary_not = false
ij_typescript_space_before_async_arrow_lparen = true
ij_typescript_space_before_catch_keyword = true
ij_typescript_space_before_catch_left_brace = true
ij_typescript_space_before_catch_parentheses = true
ij_typescript_space_before_class_lbrace = true
ij_typescript_space_before_class_left_brace = true
ij_typescript_space_before_colon = true
ij_typescript_space_before_comma = false
ij_typescript_space_before_do_left_brace = true
ij_typescript_space_before_else_keyword = true
ij_typescript_space_before_else_left_brace = true
ij_typescript_space_before_finally_keyword = true
ij_typescript_space_before_finally_left_brace = true
ij_typescript_space_before_for_left_brace = true
ij_typescript_space_before_for_parentheses = true
ij_typescript_space_before_for_semicolon = false
ij_typescript_space_before_function_left_parenth = true
ij_typescript_space_before_generator_mult = false
ij_typescript_space_before_if_left_brace = true
ij_typescript_space_before_if_parentheses = true
ij_typescript_space_before_method_call_parentheses = false
ij_typescript_space_before_method_left_brace = true
ij_typescript_space_before_method_parentheses = false
ij_typescript_space_before_property_colon = false
ij_typescript_space_before_quest = true
ij_typescript_space_before_switch_left_brace = true
ij_typescript_space_before_switch_parentheses = true
ij_typescript_space_before_try_left_brace = true
ij_typescript_space_before_type_colon = false
ij_typescript_space_before_unary_not = false
ij_typescript_space_before_while_keyword = true
ij_typescript_space_before_while_left_brace = true
ij_typescript_space_before_while_parentheses = true
ij_typescript_spaces_around_additive_operators = true
ij_typescript_spaces_around_arrow_function_operator = true
ij_typescript_spaces_around_assignment_operators = true
ij_typescript_spaces_around_bitwise_operators = true
ij_typescript_spaces_around_equality_operators = true
ij_typescript_spaces_around_logical_operators = true
ij_typescript_spaces_around_multiplicative_operators = true
ij_typescript_spaces_around_relational_operators = true
ij_typescript_spaces_around_shift_operators = true
ij_typescript_spaces_around_unary_operator = false
ij_typescript_spaces_within_array_initializer_brackets = false
ij_typescript_spaces_within_brackets = false
ij_typescript_spaces_within_catch_parentheses = false
ij_typescript_spaces_within_for_parentheses = false
ij_typescript_spaces_within_if_parentheses = false
ij_typescript_spaces_within_imports = false
ij_typescript_spaces_within_interpolation_expressions = false
ij_typescript_spaces_within_method_call_parentheses = false
ij_typescript_spaces_within_method_parentheses = false
ij_typescript_spaces_within_object_literal_braces = false
ij_typescript_spaces_within_object_type_braces = true
ij_typescript_spaces_within_parentheses = false
ij_typescript_spaces_within_switch_parentheses = false
ij_typescript_spaces_within_type_assertion = false
ij_typescript_spaces_within_union_types = true
ij_typescript_spaces_within_while_parentheses = false
ij_typescript_special_else_if_treatment = true
ij_typescript_ternary_operation_signs_on_next_line = false
ij_typescript_ternary_operation_wrap = off
ij_typescript_union_types_wrap = on_every_item
ij_typescript_use_chained_calls_group_indents = false
ij_typescript_use_double_quotes = true
ij_typescript_use_explicit_js_extension = global
ij_typescript_use_path_mapping = always
ij_typescript_use_public_modifier = false
ij_typescript_use_semicolon_after_statement = true
ij_typescript_var_declaration_wrap = normal
ij_typescript_while_brace_force = never
ij_typescript_while_on_new_line = false
ij_typescript_wrap_comments = false
[{*.yml,*.yaml}]
indent_size = 2
ij_yaml_keep_indents_on_empty_lines = false
ij_yaml_keep_line_breaks = true
[{.eslintrc,composer.lock,.stylelintrc,.babelrc,jest.config,bowerrc,*.json,*.jsb3,*.jsb2}]
indent_size = 2
ij_json_keep_blank_lines_in_code = 0
ij_json_keep_indents_on_empty_lines = false
ij_json_keep_line_breaks = true
ij_json_space_after_colon = true
ij_json_space_after_comma = true
ij_json_space_before_colon = true
ij_json_space_before_comma = false
ij_json_spaces_within_braces = false
ij_json_spaces_within_brackets = false
ij_json_wrap_long_lines = false
[{phpunit.xml.dist,*.xslt,*.xul,*.rng,*.xsl,*.xsd,*.ant,*.jhm,*.tld,*.fxml,*.wsdl,*.jrxml,*.xml,*.jnlp}]
ij_xml_block_comment_at_first_column = true
ij_xml_keep_indents_on_empty_lines = false
ij_xml_line_comment_at_first_column = true

42
.github/workflows/build-release.yml vendored Normal file
View File

@ -0,0 +1,42 @@
name: Build Release
on:
push:
pull_request:
jobs:
build:
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: Update operating system software repository
run: sudo apt-get update
- name: Install operating system dependencies
run: sudo apt-get install -y git tar gzip xz-utils zip php-cli
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Fetch version information
run: git fetch origin +refs/tags/*:refs/tags/* +refs/heads/*:refs/remotes/origin/*
# Remove this step if the old version tags make it to the official repository.
- name: Fetch version information from really old releases
run: |
git remote add deltik https://github.com/Deltik/e107.git
git fetch deltik +refs/tags/*:refs/tags/* +refs/heads/*:refs/remotes/origin/*
- name: Run build script
run: php -dphar.readonly=0 e107_make.php
working-directory: ./.github/workflows/build-release/
- name: Upload build artifacts
uses: actions/upload-artifact@v1
with:
name: release_files
path: ./.github/workflows/build-release/target/e107/release/

View File

@ -0,0 +1 @@
target/

View File

@ -0,0 +1,160 @@
<?php
/**
* e107 website system
*
* Copyright (C) 2008-2020 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*/
abstract class CoreImage
{
protected function create_image($exportFolder, $tempFolder, $currentVersion)
{
echo("[Core-Image] Scanning Dir: " . $exportFolder . "\n");
$this->generateCurrentChecksums($exportFolder, $currentVersion);
echo("[Core-Image] Scanning Removed Files from Git" . "\n");
$this->generateRemovedChecksums($tempFolder);
}
protected function generateCurrentChecksums($exportFolder, $currentVersion)
{
$absoluteBase = realpath($exportFolder);
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($exportFolder));
/**
* @var $file DirectoryIterator
*/
foreach ($iterator as $file)
{
if ($file->isDir()) continue;
$absolutePath = $file->getRealPath();
$relativePath = preg_replace("/^" . preg_quote($absoluteBase . "/", "/") . "/", "", $absolutePath);
if (empty($relativePath) || $relativePath == $absolutePath) continue;
$checksum = $this->checksumPath($absolutePath);
$this->insertChecksumIntoDatabase($relativePath, $checksum, $currentVersion);
}
}
protected function checksumPath($filename)
{
return $this->checksum(file_get_contents($filename));
}
protected function checksum($body)
{
return md5(str_replace(array(chr(13), chr(10)), '', $body));
}
abstract protected function insertChecksumIntoDatabase(&$relativePath, &$checksum, &$releaseVersion);
protected function generateRemovedChecksums($tempFolder)
{
$tags = $this->getGitTags();
$timeMachineFolder = $this->prepTimeMachine($tempFolder);
$this->generateRemovedChecksumsFromTags($tags, $timeMachineFolder);
}
/**
* @return array
*/
protected function getGitTags()
{
$stdout = '';
OsHelper::runValidated('git tag --list ' . escapeshellarg("v*"), $stdout);
$tags = explode("\n", trim($stdout));
$versions = [];
foreach ($tags as $tag)
{
$versions[] = preg_replace("/^v/", "", $tag);
}
$tags = array_combine($tags, $versions);
unset($versions);
uasort($tags, function ($a, $b)
{
return -version_compare($a, $b);
});
$tags = array_filter($tags, function ($version)
{
return !preg_match("/[a-z]/i", $version);
});
return $tags;
}
/**
* @param $tempFolder
* @param $repoFolder
* @return string
*/
protected function prepTimeMachine($tempFolder)
{
$timeMachineFolder = $tempFolder . "/git_time_machine/";
OsHelper::runValidated('mkdir -p ' . escapeshellarg($timeMachineFolder));
OsHelper::runValidated('git rev-parse --show-toplevel', $repoFolder);
$repoFolder = realpath(trim($repoFolder) . "/.git");
OsHelper::runValidated(
'cp -a ' .
escapeshellarg($repoFolder) .
' ' .
escapeshellarg($timeMachineFolder)
);
return $timeMachineFolder;
}
/**
* @param array $tags
* @param $timeMachineFolder
* @return mixed
*/
protected function generateRemovedChecksumsFromTags($tags, $timeMachineFolder)
{
foreach ($tags as $tag => $version)
{
$stdout = '';
OsHelper::runValidated(
'git --no-pager diff --no-renames --name-only --diff-filter D ' . escapeshellarg($tag),
$stdout
);
$removedFiles = explode("\n", trim($stdout));
OsHelper::runValidated(
'git -C ' . escapeshellarg($timeMachineFolder) . ' ' .
'checkout ' . escapeshellarg($tag)
);
foreach ($removedFiles as $removedFilePath)
{
$checksum = $this->checksumPath($timeMachineFolder . '/' . $removedFilePath);
$this->insertChecksumIntoDatabase($removedFilePath, $checksum, $version);
}
}
OsHelper::runValidated('rm -rf ' . escapeshellarg($timeMachineFolder));
}
protected function generateStub()
{
$data = "<?php\n";
$data .= "/*\n";
$data .= "+ ----------------------------------------------------------------------------+\n";
$data .= "| e107 website system\n";
$data .= "|\n";
$data .= "| Copyright (C) 2008-" . date("Y") . " e107 Inc. \n";
$data .= "| http://e107.org\n";
// $data .= "| jalist@e107.org\n";
$data .= "|\n";
$data .= "| Released under the terms and conditions of the\n";
$data .= "| GNU General Public License (http://gnu.org).\n";
$data .= "|\n";
$data .= "| \$URL$\n";
$data .= "| \$Id$\n";
$data .= "+----------------------------------------------------------------------------+\n";
$data .= "*/\n\n";
$data .= "if (!defined('e107_INIT')) { exit; }\n\n";
return $data;
}
}

View File

@ -0,0 +1,134 @@
<?php
/**
* e107 website system
*
* Copyright (C) 2008-2020 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*/
require_once("OsHelper.php");
require_once("CoreImage.php");
class JsonCoreImage extends CoreImage
{
protected $checksums = [];
public function __construct($exportFolder, $tempFolder, $currentVersion, $imageFile)
{
$this->create_image($exportFolder, $tempFolder, $currentVersion);
$this->saveImage($imageFile);
}
/**
* @param $imageFile
*/
protected function saveImage($imageFile)
{
$json_result = json_encode($this->checksums, JSON_PRETTY_PRINT);
$json_string_result = var_export($json_result, true);
$data = $this->generateStub();
$data .= '$core_image = ' . $json_string_result . ';';
$fp = fopen($imageFile, 'w');
fwrite($fp, $data);
}
protected function generateCurrentChecksums($exportFolder, $currentVersion)
{
parent::generateCurrentChecksums($exportFolder, $currentVersion);
ksort($this->checksums);
}
protected function generateRemovedChecksums($tempFolder)
{
parent::generateRemovedChecksums($tempFolder);
ksort($this->checksums);
}
/**
* @inheritDoc
*/
protected function insertChecksumIntoDatabase(&$relativePath, &$checksum, &$version)
{
$item = self::array_get($this->checksums, $relativePath, []);
if (!in_array($checksum, $item)) $item["v{$version}"] = $checksum;
self::array_set($this->checksums, $relativePath, $item);
}
/**
* Get an item from an array using "slash" notation.
*
* Based on Illuminate\Support\Arr::get()
*
* @param array $array
* @param string $key
* @param mixed $default
* @return mixed
* @copyright Copyright (c) Taylor Otwell
* @license https://github.com/illuminate/support/blob/master/LICENSE.md MIT License
*/
private static function array_get($array, $key, $default = null)
{
if (is_null($key)) return $array;
if (isset($array[$key])) return $array[$key];
foreach (explode('/', $key) as $segment)
{
if (!is_array($array) || !array_key_exists($segment, $array))
{
return $default;
}
$array = $array[$segment];
}
return $array;
}
/**
* Set an array item to a given value using "slash" notation.
*
* If no key is given to the method, the entire array will be replaced.
*
* Based on Illuminate\Support\Arr::set()
*
* @param array $array
* @param string|null $key
* @param mixed $value
* @return array
* @copyright Copyright (c) Taylor Otwell
* @license https://github.com/illuminate/support/blob/master/LICENSE.md MIT License
*/
private static function array_set(&$array, $key, $value)
{
if (is_null($key))
{
return $array = $value;
}
$keys = explode('/', $key);
while (count($keys) > 1)
{
$key = array_shift($keys);
// If the key doesn't exist at this depth, we will just create an empty array
// to hold the next value, allowing us to create the arrays to hold final
// values at the correct depth. Then we'll keep digging into the array.
if (!isset($array[$key]) || !is_array($array[$key]))
{
$array[$key] = [];
}
$array = &$array[$key];
}
$array[array_shift($keys)] = $value;
return $array;
}
}

View File

@ -0,0 +1,41 @@
<?php
/**
* e107 website system
*
* Copyright (C) 2008-2020 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*/
require_once("JsonCoreImage.php");
class JsonPharCoreImage extends JsonCoreImage
{
protected function saveImage($imageFile)
{
$imagePharFile = "$imageFile.phar";
$phar = new Phar($imagePharFile);
$json_result = json_encode($this->checksums);
$imageJsonFile = "$imageFile.json";
$fp = fopen($imageJsonFile, 'w');
fwrite($fp, $json_result);
fclose($fp);
$phar->startBuffering();
$phar->setStub($this->generateStub());
$phar->addFile($imageJsonFile, "core_image.json");
$phar->compressFiles(Phar::GZ);
$phar->stopBuffering();
rename($imagePharFile, $imageFile);
}
protected function generateStub()
{
$data = parent::generateStub();
$data .= "__HALT_COMPILER();";
return $data;
}
}

View File

@ -0,0 +1,87 @@
<?php
/**
* e107 website system
*
* Copyright (C) 2008-2020 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*/
class OsHelper
{
/**
* @param string $command The command to run
* @param string $stdout Reference to the STDOUT output as a string
* @param string $stderr Reference to the STDERR output as a string
* @return int Return code of the command that was run
*/
public static function run($command, &$stdout = "", &$stderr = "")
{
$stdout = $stderr = "";
$descriptorspec = [
1 => ['pipe', 'w'],
2 => ['pipe', 'w'],
];
$pipes = [];
$resource = proc_open($command, $descriptorspec, $pipes);
$stdout .= stream_get_contents($pipes[1]);
$stderr .= stream_get_contents($pipes[2]);
foreach ($pipes as $pipe)
{
fclose($pipe);
}
return proc_close($resource);
}
public static function runValidated($command, &$stdout = "", &$stderr = "")
{
$rc = OsHelper::run($command, $stdout, $stderr);
if ($rc != 0)
{
throw new RuntimeException(
"Error while running command (rc=$rc): " . $command . PHP_EOL .
"========== STDOUT ==========" . PHP_EOL .
$stdout . PHP_EOL .
"========== STDERR ==========" . PHP_EOL .
$stderr . PHP_EOL
);
}
return $rc;
}
public static function gitVersionToPhpVersion($gitVersion, $verFileVersion = "0")
{
$verFileVersion = array_shift(explode(" ", $verFileVersion));
$version = preg_replace("/^v/", "", $gitVersion);
$versionSplit = explode("-", $version);
if (count($versionSplit) > 1)
{
if (version_compare($verFileVersion, $versionSplit[0], '>')) $versionSplit[0] = $verFileVersion;
$versionSplit[0] .= "dev";
}
return implode("-", $versionSplit);
}
public static function getVerFileVersion($verFilePath)
{
$verFileTokens = token_get_all(file_get_contents($verFilePath));
$nextConstantEncapsedStringIsVersion = false;
foreach ($verFileTokens as $verFileToken)
{
if (!isset($verFileToken[1])) continue;
$token = $verFileToken[0];
$value = trim($verFileToken[1], "'\"");
if ($token === T_CONSTANT_ENCAPSED_STRING)
{
if ($nextConstantEncapsedStringIsVersion)
{
return $value;
}
if ($value === 'e107_version') $nextConstantEncapsedStringIsVersion = true;
}
}
return '0';
}
}

View File

@ -0,0 +1,148 @@
<?php
/**
* e107 website system
*
* Copyright (C) 2008-2020 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*/
require_once("OsHelper.php");
require_once("CoreImage.php");
class SqlpharCoreImage extends CoreImage
{
/** @var PDO */
protected $db;
/**
* @var PDOStatement
*/
private $insert_statement;
/**
* @var PDOStatement
*/
private $check_statement;
// Insert bindings
private $relativePath;
private $releaseVersion;
private $checksum;
public function __construct($exportFolder, $tempFolder, $currentVersion, $imageFile)
{
$imagePharFile = "$imageFile.phar";
$phar = new Phar($imagePharFile);
$imageSqliteFile = "$imageFile.sqlite";
file_put_contents($imageSqliteFile, '');
$this->db = new PDO("sqlite:{$imageSqliteFile}");
$this->db->exec('
CREATE TABLE IF NOT EXISTS file_hashes (
path TEXT,
release_version INTEGER,
hash TEXT'/*.',
UNIQUE(path, hash) ON CONFLICT IGNORE'*/ . '
);
');
$this->db->exec('
CREATE TABLE IF NOT EXISTS versions (
version_id INTEGER PRIMARY KEY,
version_string TEXT,
UNIQUE(version_string) ON CONFLICT IGNORE
);
');
# Retrieval:
# SELECT file_hashes.path, versions.version_string, file_hashes.hash
# FROM file_hashes
# LEFT JOIN versions ON versions.version_id = file_hashes.release_version
# ORDER BY path ASC;
$this->check_statement = $this->db->prepare('SELECT COUNT(*) FROM file_hashes WHERE path = :path AND hash = :hash');
$this->insert_statement = $this->bind_insert(
$this->relativePath,
$this->releaseVersion,
$this->checksum);
$this->create_image($exportFolder, $tempFolder, $currentVersion);
$phar->startBuffering();
$phar->setStub($this->generateStub());
$phar->addFile($imageSqliteFile, "core_image.sqlite");
$phar->compressFiles(Phar::BZ2);
$phar->stopBuffering();
rename($imagePharFile, $imageFile);
}
protected function generateCurrentChecksums($exportFolder, $currentVersion)
{
$this->db->beginTransaction();
$this->insert_version($currentVersion);
parent::generateCurrentChecksums($exportFolder, $currentVersion);
$this->db->commit();
}
/**
* @param $relativePath
* @param $releaseVersion
* @param $checksum
* @return PDOStatement
*/
private function bind_insert(&$relativePath, &$releaseVersion, &$checksum)
{
$relativePath = $relativePath ?: null;
$releaseVersion = $releaseVersion ?: null;
$checksum = $checksum ?: null;
$insert_statement = $this->db->prepare(
"INSERT INTO file_hashes (
path, release_version, hash
) VALUES (
:path, (SELECT version_id FROM versions WHERE version_string = :release_version), :hash
)"
);
$insert_statement->bindParam(":path", $relativePath);
$insert_statement->bindParam(":release_version", $releaseVersion);
$insert_statement->bindParam(":hash", $checksum);
return $this->insert_statement = $insert_statement;
}
private function insert_version($releaseVersion)
{
$statement = $this->db->prepare(
"INSERT INTO versions (version_id, version_string) VALUES (NULL, ?)"
);
$statement->execute([$releaseVersion]);
}
protected function generateRemovedChecksums($tempFolder)
{
$this->db->beginTransaction();
$tags = $this->getGitTags();
foreach ($tags as $tag => $version)
{
$this->insert_version($version);
}
parent::generateRemovedChecksums($tempFolder);
$this->db->commit();
}
protected function generateStub()
{
$data = parent::generateStub();
$data .= "__HALT_COMPILER();";
return $data;
}
/**
* @inheritDoc
*/
protected function insertChecksumIntoDatabase(&$relativePath, &$checksum, &$releaseVersion)
{
$this->relativePath = $relativePath;
$this->checksum = $checksum;
$this->releaseVersion = $releaseVersion;
$this->check_statement->execute([':path' => $relativePath, ':hash' => $checksum]);
if ($this->check_statement->fetchColumn() == 0) $this->insert_statement->execute();
}
}

View File

@ -0,0 +1,520 @@
<?php
/**
* e107 website system
*
* Copyright (C) 2008-2020 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*/
require_once("OsHelper.php");
require_once("JsonPharCoreImage.php");
$builder = new e107Build();
$builder->makeBuild();
class e107Build
{
var $releaseDir = "";
var $tempDir = null;
var $exportDir = null;
var $gitDir = null;
var $stagingDir = null;
protected $config;
protected $version;
public function __construct()
{
$this->config['baseDir'] = dirname(__FILE__);
$iniFile = $this->config['baseDir'] . '/make.ini';
if (is_readable($iniFile))
{
$this->status('Reading config file: ' . $iniFile);
$this->config = parse_ini_file($iniFile, true);
}
else
{
throw new RuntimeException("Configuration file " . escapeshellarg($iniFile) . " not found.");
}
foreach ($this->config as $k => $v)
{
if (preg_match('#release_(\d*)#', $k, $matches))
{
$this->config['releases'][] = $v;
unset($this->config[$k]);
}
}
$this->config['baseDir'] = dirname(__FILE__);
$this->exportDir = "{$this->config['baseDir']}/target/{$this->config['main']['name']}/export/";
$this->tempDir = "{$this->config['baseDir']}/target/{$this->config['main']['name']}/temp/";
$this->stagingDir = "{$this->config['baseDir']}/target/{$this->config['main']['name']}/staging/";
$rc = 255;
$output = [];
exec("git rev-parse --show-toplevel", $output, $rc);
$gitRoot = array_pop($output);
if (!is_dir($gitRoot))
{
throw new RuntimeException("Error getting Git repo root (rc=$rc). Output was garbage: $gitRoot");
}
$this->gitDir = realpath($gitRoot);
exec("git describe --tags", $output, $rc);
$gitVersion = array_pop($output);
$verFileVersion = OsHelper::getVerFileVersion($this->gitDir . "/e107_admin/ver.php");
$this->version = OsHelper::gitVersionToPhpVersion($gitVersion, $verFileVersion);
$this->validateReadme();
}
private function status($msg, $heading = false)
{
if ($heading == false)
{
echo date('m/d/Y h:i:s') . ' ';
}
else
{
echo "\n\n>>>> ";
}
echo $msg . "\n";
if ($heading != false)
{
echo "\n";
}
}
private function validateReadme()
{
//check for readme files associated with configured releases
foreach ($this->config['releases'] as $rel)
{
if (isset($rel['readme']))
{
$fname = "{$this->config['baseDir']}/readme/{$this->config['main']['name']}/{$rel['readme']}";
if (!is_readable($fname))
{
throw new RuntimeException("ERROR: readme file $fname does not exist.");
}
}
}
}
public function makeBuild()
{
$this->status("Building release " . $this->version);
$this->cleanupFiles();
$this->preprocess();
$this->createReleases();
echo "\n\nDONE!!!\n\n\n";
}
private function cleanupFiles()
{
$dir = "{$this->config['baseDir']}/target/{$this->config['main']['name']}";
if (file_exists($dir))
{
$this->status("Cleaning up old target directory ($dir)");
$cmd = "rm -rf " . escapeshellarg($dir);
OsHelper::runValidated($cmd);
$this->changeDir($this->config['baseDir']);
}
else
{
$this->status("Creating new target directory ($dir)");
$cmd = "mkdir -pv " . escapeshellarg($dir);
OsHelper::runValidated($cmd);
}
if (file_exists($dir . '/temp'))
{
throw new RuntimeException("Target Directory Not Clean! Aborting...");
}
$cmd = "mkdir -pv " . escapeshellarg($dir . "/temp");
OsHelper::runValidated($cmd);
$cmd = "mkdir -pv " . escapeshellarg($dir . "/release");
OsHelper::runValidated($cmd);
$releaseDir = "e107_" . $this->version;
$this->releaseDir = $releaseDir;
$this->status("Creating new release directory ($releaseDir)", true);
$cmd = "mkdir -pv " . escapeshellarg($dir . "/release/" . $releaseDir);
OsHelper::runValidated($cmd);
return true;
}
/*
private function targetClone()
{
$rc = 255;
$output = [];
exec("git rev-parse --show-toplevel", $output, $rc);
$gitRoot = array_pop($output);
if (!is_dir($gitRoot))
{
$this->status("Error getting Git repo root (rc=$rc). Output was garbage: $gitRoot");
return false;
}
$gitRoot = realpath($gitRoot);
mkdir($this->stagingDir, 0755, true);
$stagingDir = realpath($this->stagingDir);
$stagingDirLocalSegment = preg_replace("/^" . preg_quote($gitRoot, "/") . "/", "", $stagingDir);
if ($stagingDirLocalSegment == $stagingDir)
{
$this->status("Staging dir \"$stagingDir\" is currently not supported outside repo root \"$gitRoot\"");
}
$cloneCommand =
"rsync -avHXShPs" .
" --exclude=" . escapeshellarg($stagingDirLocalSegment . "/") .
" --delete-after --delete-excluded" .
" --link-dest=" . escapeshellarg($gitRoot) .
" " . escapeshellarg($gitRoot . "/") .
" " . escapeshellarg($stagingDir . "/");
exec($cloneCommand, $output, $rc);
return $rc;
}
*/
private function changeDir($dir)
{
$this->status("Changing to dir: " . $dir);
chdir($dir);
}
private function preprocess()
{
return true;
}
private function createReleases()
{
foreach ($this->config['releases'] as $c => $rel)
{
$this->status(" ------------------ Release " . $c . "--------------------------- ", true);
$this->emptyExportDir();
$zipExportFile = 'release_' . $c . ".zip";
$since = isset($rel['since']) ? $rel['since'] : null;
$this->gitArchive($zipExportFile, $since);
$this->gitArchiveUnzip($zipExportFile);
$this->editVersion('export');
$this->changeDir($this->exportDir);
foreach ($rel as $name => $val)
{
switch ($name)
{
case "files_create" :
$this->filesCreate($val);
break;
case "files_rename" :
$this->filesRename($val);
break;
case "files_delete" :
$this->filesDelete($val);
break;
case "plugin_delete" :
$this->pluginRemove($val);
break;
}
}
if ($rel['type'] == 'full')
{
$this->CreateCoreImage(); // Create Image
}
$this->copyCoreImage();
if (isset($rel['readme']))
{
$this->moveReadme($rel['readme']);
}
$zipsince = '';
$ts = '';
$newfile = "";
if ($rel['type'] == 'full')
{
$newfile = "e107_" . $this->version . "_full";
$this->status("Creating Release " . $c . " Packages : full", true);
}
elseif ($rel['type'] == "upgrade")
{
$newfile = "e107_" . $rel['from_version'] . "_to_" . $this->version . "_upgrade";
$this->status("Creating Release " . $c . " Packages : upgrade from {$rel['from_version']}", true);
}
$releaseDir = "{$this->config['baseDir']}/target/{$this->config['main']['name']}/release/" . $this->releaseDir;
/**
* git archive -o update.zip HEAD $(git diff --name-only [id])
*
* Of course you need to replace the [id]-part with the ID of your commit. So if the ID of your commit is 599313e986c56e5451caa14d32c6b18273f4331b then your command would look like this:
* git archive -o update.zip HEAD $(git diff --name-only 599313e986c56e5451caa14d32c6b18273f4331b)
* 1
*
* git archive -o update.zip HEAD $(git diff --name-only 599313e986c56e5451caa14d32c6b18273f4331b)
*/
$zipfile = $releaseDir . '/' . $newfile . '.zip';
$tarfile = $releaseDir . '/' . $newfile . '.tar';
$zipcmd = "zip -9 -r{$zipsince} $zipfile . 2>&1";
$tarcmd = "tar --owner=0 --group=0 -cf $tarfile {$ts} . 2>&1";
$this->status('Creating ZIP archive');
$this->status($zipcmd);
OsHelper::runValidated($zipcmd);
$this->status('Creating TAR archive');
$this->status($tarcmd);
OsHelper::runValidated($tarcmd);
$this->status('Creating TAR.GZ archive');
OsHelper::runValidated("(cat $tarfile | gzip -9 > $tarfile.gz)");
$this->status('Creating TAR.XZ archive');
OsHelper::runValidated("(cat $tarfile | xz -9 > $tarfile.xz)");
$this->status('Removing TAR archive');
unlink($tarfile);
} // end loop
}
private function emptyExportDir()
{
if (is_dir($this->exportDir))
{
$this->rmdir($this->exportDir);
}
$this->status("Making export directory. ");
mkdir($this->exportDir, 0755);
}
private function rmdir($dir)
{
if (!is_dir($dir))
{
return false;
}
$this->status("Removing directory: " . $dir);
$dir = rtrim($dir, "/");
$cmd = "rm -rf " . escapeshellarg($dir);
$this->status($cmd);
OsHelper::runValidated($cmd);
return true;
}
private function gitArchive($zipFile, $since = null)
{
$file = $this->tempDir . $zipFile;
$this->status("Zipping up temp Release archive..");
if (!empty($since))
{
$cmd = "git archive -o " . escapeshellarg($file) . " HEAD $(git diff --name-only --diff-filter=ACMRTUXB " . escapeshellarg($since) . ")";
}
else
{
$cmd = "git archive -o " . escapeshellarg($file) . " HEAD";
}
$this->changeDir($this->gitDir);
OsHelper::runValidated($cmd);
}
private function gitArchiveUnzip($file)
{
$this->status("Unzipping temp archive to export folder", true);
$filepath = $this->tempDir . $file;
$cmd = 'unzip -q -o ' . escapeshellarg($filepath) . ' -d ' . escapeshellarg($this->exportDir);
OsHelper::runValidated($cmd);
OsHelper::runValidated('chmod -R a=,u+rwX,go+rX ' . escapeshellarg($this->exportDir));
}
private function editVersion($dir = 'export')
{
$version = $this->version;
if (strpos($version, "-") !== false)
{
$version .= " nightly build " . date('Ymd');
}
$fname = "{$this->config['baseDir']}/target/{$this->config['main']['name']}/" . $dir . "/e107_admin/ver.php";
$this->status("Writing new version {$version} to ver.php in " . $dir . " directory.", true);
$contents = "<?php\n";
$contents .= "/*\n";
$contents .= "* Copyright (c) " . date("Y") . " e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)\n";
$contents .= "*\n";
$contents .= "* Version file\n";
$contents .= "*/\n\n";
$contents .= "if (!defined('e107_INIT')) { exit; }\n\n";
$contents .= "\$e107info['e107_version'] = \"{$version}\";\n";
$contents .= "?>\n";
return file_put_contents($fname, $contents);
}
private function filesCreate($parm)
{
$fnames = explode(",", $parm);
foreach ($fnames as $fn)
{
$fn = trim($fn);
$result = touch($fn);
$this->status("Creating $fn - " . ($result ? "SUCCESS" : "FAIL"));
if (!$result) throw new RuntimeException("Failed to touch: $fn");
}
}
private function filesRename($parm)
{
$pair = explode(',', $parm);
foreach ($pair as $fn)
{
list($old, $new) = explode('->', $fn);
$result = rename($old, $new);
$this->status("Renaming {$old} to {$new} " . ($result ? "SUCCESS" : "FAIL"));
if (!$result)
throw new RuntimeException(
"Failed to rename " . escapeshellarg($old) . " to " . escapeshellarg($new)
);
}
}
private function filesDelete($parm)
{
$fnames = explode(',', $parm);
foreach ($fnames as $fn)
{
$fn = trim($fn);
if (file_exists($fn))
{
if (is_file($fn)) $result = unlink($fn);
elseif (is_dir($fn)) $result = $this->rmdir($fn);
else $result = false;
$this->status("Deleting $fn - " . ($result ? "SUCCESS" : "FAIL"));
if (!$result) throw new RuntimeException("Failed to delete: $fn");
}
else
{
$this->status("File already deleted or absent - " . $fn);
}
}
}
private function pluginRemove($parm, $restore = false)
{
if ($restore)
{
$this->status("Running Plugin-Restore", true);
}
else
{
$this->status("Running Plugin-Remove", true);
}
$fnames = explode(',', $parm);
if ($restore == true)
{
return;
}
foreach ($fnames as $fn)
{
$fn = trim($fn);
$dir = "{$this->config['baseDir']}/target/{$this->config['main']['name']}/export/e107_plugins/" . $fn;
$this->rmdir($dir);
}
}
private function createCoreImage()
{
//create new image file - writes directly to cvsroot
$this->changeDir($this->config['baseDir']);
$imageFile = $this->tempDir . "core_image.php";
$this->status("Creating new core_image.php file ({$imageFile})", true);
new JsonPharCoreImage($this->exportDir, $this->tempDir, $this->version, $imageFile);
$dir = "{$this->config['baseDir']}/target/{$this->config['main']['name']}/export";
$this->changeDir($dir);
}
private function copyCoreImage()
{
$orig = $this->tempDir . "core_image.php";
$dest = $this->exportDir . "e107_admin/core_image.php";
if (!file_exists($orig))
{
throw new RuntimeException("Core image file not found: {$orig}");
}
$this->status("Copying Core Image into export directory", true);
OsHelper::runValidated("cp -rf " . escapeshellarg($orig) . " " . escapeshellarg($dest));
if (!file_exists($dest))
{
throw new RuntimeException("Core image file didnt copy to: {$dest}");
}
}
private function moveReadme($readme)
{
$from = "{$this->config['baseDir']}/readme/{$this->config['main']['name']}/{$readme}";
$to = "{$this->config['baseDir']}/target/{$this->config['main']['name']}/export/README.txt";
$result = copy($from, $to);
$this->status("Copying readme file $readme to $to - " . ($result ? "SUCCESS" : "FAIL"));
if (!$result) throw new RuntimeException("Failed to copy $readme to $to");
}
}

View File

@ -0,0 +1,30 @@
[main]
name=e107
svn_path=https://github.com/e107inc/e107/trunk
svn_tag_path=https://github.com/e107inc/e107/tags
svn_username=<username>
svn_password="<password>"
git_repo=https://github.com/e107inc/e107.git
[preprocess]
files_delete=.gitignore,.codeclimate.yml,.editorconfig
files_create=e107_config.php
[release_1]
type=full
plugin_delete=alt_auth,newsletter,faqs,metaweblog,pdf,newforumposts_main
files_create=e107_config.php
files_delete=.gitignore,.gitmodules,.codeclimate.yml,.editorconfig,composer.json,composer.lock,e107_tests,.github
[release_2]
type=upgrade
plugin_delete=faqs,metaweblog,pdf
files_delete=install.php,favicon.ico,.gitignore,.gitmodules,.codeclimate.yml,.editorconfig,composer.json,composer.lock,e107_tests,.github
from_version=v1.x
[release_3]
type=upgrade
plugin_delete=alt_auth,newsletter,calendar_menu,tree_menu,faqs,metaweblog,pdf
files_delete=install.php,favicon.ico,.gitignore,.gitmodules,.codeclimate.yml,.editorconfig,composer.json,composer.lock,e107_tests,.github
from_version=v2.x
since=2bd75d426b320ee0192e6f403ff1e561d2f38098

View File

@ -56,7 +56,7 @@ jobs:
grep -m1 -P '^deb http://deb.debian.org/debian [a-z]+ main' /etc/apt/sources.list |
awk '{print $3}'
)
apt-get -t "${DEBIAN_RELEASE}-backports" install -y git zip libzip-dev libpng-dev libjpeg-dev
apt-get -t "${DEBIAN_RELEASE}-backports" install -y git zip libzip-dev libbz2-dev libpng-dev libjpeg-dev
- name: Configure PHP gd extension with JPEG support
run: |
@ -70,7 +70,7 @@ jobs:
- name: Install necessary PHP extensions
run: |
docker-php-ext-install -j "$(nproc)" \
zip gd pdo_mysql mysqli
zip bz2 gd pdo_mysql mysqli
- name: PECL install xdebug
run: |

View File

@ -2033,7 +2033,7 @@ e107::getDebug()->log("Timezone: ".USERTIMEZONE); // remove later on.
define('USERNAME', 'e107-cli');
define('USERTHEME', false);
define('ADMIN', true);
define('ADMINPERMS', false);
define('ADMINPERMS', '0');
define('GUEST', false);
define('USERCLASS', '');
define('USEREMAIL', '');

View File

@ -21,6 +21,8 @@
},
"require": {
"php": ">=5.6",
"ext-json": "*",
"ext-pdo": "*",
"hybridauth/hybridauth": "^3.1.1",
"phpmailer/phpmailer": "^6.1",
"tedivm/jshrink": "^1.3",

View File

@ -127,32 +127,8 @@ class admin_start
}
// Files that can cause comflicts and problems.
$this->deprecated = array(
e_ADMIN."ad_links.php",
e_PLUGIN."tinymce4/e_meta.php",
e_THEME."bootstrap3/css/bootstrap_dark.css",
e_PLUGIN."search_menu/languages/English.php",
e_LANGUAGEDIR.e_LANGUAGE."/lan_parser_functions.php",
e_LANGUAGEDIR.e_LANGUAGE."/admin/help/theme.php",
e_HANDLER."np_class.php",
e_CORE."shortcodes/single/user_extended.sc",
e_ADMIN."download.php",
e_PLUGIN."banner/config.php",
e_PLUGIN."forum/newforumposts_menu_config.php",
e_PLUGIN."forum/e_latest.php",
e_PLUGIN."forum/e_status.php",
e_PLUGIN."forum/forum_post_shortcodes.php",
e_PLUGIN."forum/forum_shortcodes.php",
e_PLUGIN."forum/forum_update_check.php",
e_PLUGIN."online_extended_menu/online_extended_menu.php",
e_PLUGIN."online_extended_menu/images/user.png",
e_PLUGIN."online_extended_menu/languages/English.php",
e_PLUGIN."pm/sendpm.sc",
e_PLUGIN."pm/shortcodes/",
e_PLUGIN."social/e_header.php",
// e_PLUGIN."download/url/url.php", // removed by download_setup.php
// e_PLUGIN."download/url/sef_url.php",
);
$fileInspector = e107::getFileInspector();
$this->deprecated = $fileInspector->insecureFiles;
$this->checkCoreVersion();

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -193,6 +193,7 @@ class e107
'e_bb_base' => '{e_HANDLER}bbcode_handler.php',
'e_customfields' => '{e_HANDLER}e_customfields_class.php',
'e_file' => '{e_HANDLER}file_class.php',
'e_file_inspector_json_phar' => '{e_HANDLER}e_file_inspector_json_phar.php',
'e_form' => '{e_HANDLER}form_handler.php',
'e_jshelper' => '{e_HANDLER}js_helper.php',
'e_media' => '{e_HANDLER}media_class.php',
@ -1601,6 +1602,18 @@ class e107
return self::getObject('e_file', null, true);
}
/**
* Create a new file inspector object
*
* Note: Only the core file inspector is supported right now.
*
* @return e_file_inspector
*/
public static function getFileInspector($type = 'core')
{
return self::getObject('e_file_inspector_json_phar', e_ADMIN . "core_image.php");
}
/**
* Retrieve form handler singleton or new fresh object
*

View File

@ -0,0 +1,301 @@
<?php
/**
* e107 website system
*
* Copyright (C) 2008-2020 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*/
require_once("e_file_inspector_interface.php");
/**
* File Inspector
*
* Tool to validate application files for consistency by comparing hashes of files with those in a database
*/
abstract class e_file_inspector implements e_file_inspector_interface
{
protected $database;
protected $currentVersion;
private $validatedBitmask;
protected $defaultDirsCache;
protected $customDirsCache;
private $undeterminable = array();
// FIXME: Better place for the insecure file list
public $insecureFiles = [
e_ADMIN . "ad_links.php",
e_PLUGIN . "tinymce4/e_meta.php",
e_THEME . "bootstrap3/css/bootstrap_dark.css",
e_PLUGIN . "search_menu/languages/English.php",
e_LANGUAGEDIR . e_LANGUAGE . "/lan_parser_functions.php",
e_LANGUAGEDIR . e_LANGUAGE . "/admin/help/theme.php",
e_HANDLER . "np_class.php",
e_CORE . "shortcodes/single/user_extended.sc",
e_ADMIN . "download.php",
e_PLUGIN . "banner/config.php",
e_PLUGIN . "forum/newforumposts_menu_config.php",
e_PLUGIN . "forum/e_latest.php",
e_PLUGIN . "forum/e_status.php",
e_PLUGIN . "forum/forum_post_shortcodes.php",
e_PLUGIN . "forum/forum_shortcodes.php",
e_PLUGIN . "forum/forum_update_check.php",
e_PLUGIN . "online_extended_menu/online_extended_menu.php",
e_PLUGIN . "online_extended_menu/images/user.png",
e_PLUGIN . "online_extended_menu/languages/English.php",
e_PLUGIN . "pm/sendpm.sc",
e_PLUGIN . "pm/shortcodes/",
e_PLUGIN . "social/e_header.php",
];
private $existingInsecureFiles = array();
private $existingInsecureDirectories = array();
/**
* e_file_inspector constructor
* @param string $database The database from which integrity data may be read or to which integrity data may be
* written. This should be an URL or absolute file path for most implementations.
*/
public function __construct($database)
{
$this->database = $database;
$this->loadDatabase();
$appRoot = e107::getInstance()->file_path;
$this->undeterminable = array_map(function ($path)
{
return realpath($path) ? realpath($path) : $path;
}, [
$appRoot . "e107_config.php",
$appRoot . e107::getFolder('admin') . "core_image.php",
]
);
$this->existingInsecureFiles = array_filter($this->insecureFiles, function ($path)
{
return is_file($path);
});
$this->existingInsecureFiles = array_map('realpath', $this->existingInsecureFiles);
$this->existingInsecureDirectories = array_filter($this->insecureFiles, function ($path)
{
return is_dir($path);
});
$this->existingInsecureDirectories = array_map('realpath', $this->existingInsecureDirectories);
}
/**
* Prepare the provided database for reading or writing
*
* Should tolerate a non-existent database and try to create it if a write operation is executed.
*
* @return void
*/
abstract public function loadDatabase();
/**
* Check the integrity of the provided path
*
* @param $path string Relative path of the file to look up
* @param $version string The desired software release to match.
* Leave blank for the current version.
* Do not prepend the version number with "v".
* @return int Validation code (see the constants of this class)
*/
public function validate($path, $version = null)
{
if ($version === null) $version = $this->getCurrentVersion();
$bits = 0x0;
$absolutePath = $this->relativePathToAbsolutePath($path);
$dbChecksums = $this->getChecksums($path);
$dbChecksum = $this->getChecksum($path, $version);
$actualChecksum = !empty($dbChecksums) ? $this->checksumPath($absolutePath) : null;
if (!empty($dbChecksums)) $bits |= self::VALIDATED_PATH_KNOWN;
if ($dbChecksum !== false) $bits |= self::VALIDATED_PATH_VERSION;
if (file_exists($absolutePath)) $bits |= self::VALIDATED_FILE_EXISTS;
if (!$this->isInsecure($path)) $bits |= self::VALIDATED_FILE_SECURITY;
if ($this->isDeterminable($absolutePath)) $bits |= self::VALIDATED_HASH_CALCULABLE;
if ($actualChecksum === $dbChecksum) $bits |= self::VALIDATED_HASH_CURRENT;
foreach ($dbChecksums as $dbChecksum)
{
if ($dbChecksum === $actualChecksum) $bits |= self::VALIDATED_HASH_EXISTS;
}
if ($bits + self::VALIDATED === $this->getValidatedBitmask()) $bits |= self::VALIDATED;
return $bits;
}
/**
* Get the file integrity hash for the provided path and version
*
* @param $path string Relative path of the file to look up
* @param $version string The software release version corresponding to the file hash.
* Leave blank for the current version.
* Do not prepend the version number with "v".
* @return string|bool The database hash for the path and version specified. FALSE if the record does not exist.
*/
public function getChecksum($path, $version = null)
{
if ($version === null) $version = $this->getCurrentVersion();
$checksums = $this->getChecksums($path);
return isset($checksums[$version]) ? $checksums[$version] : false;
}
/**
* Calculate the hash of a path to compare with the hash database
*
* @param $absolutePath string Absolute path of the file to hash
* @return string|bool The actual hash for the path. FALSE if the hash was incalculable.
*/
public function checksumPath($absolutePath)
{
if (!$this->isDeterminable($absolutePath)) return false;
return $this->checksum(file_get_contents($absolutePath));
}
/**
* Calculate the hash of a string, which would be used to compare with the hash database
*
* @param $content string Full content to hash
* @return string
*/
public function checksum($content)
{
return md5(str_replace(array(chr(13), chr(10)), "", $content));
}
/**
* @inheritDoc
*/
public function getVersions($path)
{
return array_keys($this->getChecksums($path));
}
/**
* @inheritDoc
*/
public function getCurrentVersion()
{
if ($this->currentVersion) return $this->currentVersion;
$checksums = $this->getChecksums("index.php");
$versions = array_keys($checksums);
usort($versions, 'version_compare');
return $this->currentVersion = array_pop($versions);
}
/**
* Get the matching version of the provided path
*
* Useful for looking up the versions of old files that no longer exist in the latest image
*
* @param $path string Relative path of the file to look up
* @return string|bool PHP-standardized version of the file. FALSE if there is no match.
*/
public function getVersion($path)
{
$actualChecksum = $this->checksumPath($path);
foreach ($this->getChecksums($path) as $dbVersion => $dbChecksum)
{
if ($actualChecksum === $dbChecksum) return $dbVersion;
}
return false;
}
/**
* @inheritDoc
*/
public function isInsecure($path)
{
$absolutePath = $this->relativePathToAbsolutePath($path);
if (in_array($absolutePath, $this->existingInsecureFiles)) return true;
foreach ($this->existingInsecureDirectories as $existingInsecureDirectory)
{
$existingInsecureDirectory .= '/';
if (substr($absolutePath, 0, strlen($existingInsecureDirectory)) === $existingInsecureDirectory) return true;
}
return false;
}
/**
* Convert a custom site path to a default path
* @param string $path Custom path
* @return string
*/
public function customPathToDefaultPath($path)
{
if (!is_array($this->customDirsCache)) $this->populateDirsCache();
foreach ($this->customDirsCache as $dirType => $customDir)
{
if (!isset($this->defaultDirsCache[$dirType])) continue;
$defaultDir = $this->defaultDirsCache[$dirType];
if ($customDir === $defaultDir) continue;
if (substr($path, 0, strlen($customDir)) === $customDir)
$path = $defaultDir . substr($path, strlen($customDir));
}
return $path;
}
public function defaultPathToCustomPath($path)
{
if (!is_array($this->customDirsCache)) $this->populateDirsCache();
foreach ($this->customDirsCache as $dirType => $customDir)
{
if (!isset($this->defaultDirsCache[$dirType])) continue;
$defaultDir = $this->defaultDirsCache[$dirType];
if ($customDir === $defaultDir) continue;
if (substr($path, 0, strlen($defaultDir)) === $defaultDir)
$path = $customDir . substr($path, strlen($defaultDir));
}
return $path;
}
private function getValidatedBitmask()
{
if ($this->validatedBitmask !== null) return $this->validatedBitmask;
$constants = (new ReflectionClass(self::class))->getConstants();
$validated_constants = array_filter($constants, function ($key)
{
$str = 'VALIDATED_';
return substr($key, 0, strlen($str)) === $str;
}, ARRAY_FILTER_USE_KEY);
$this->validatedBitmask = (max($validated_constants) << 0x1) - 0x1;
return $this->validatedBitmask;
}
/**
* @param $absolutePath
* @return bool
*/
private function isDeterminable($absolutePath)
{
return is_file($absolutePath) && is_readable($absolutePath) && !in_array($absolutePath, $this->undeterminable);
}
protected function populateDirsCache()
{
$this->defaultDirsCache = e107::getInstance()->defaultDirs();
$customDirs = e107::getInstance()->e107_dirs ? e107::getInstance()->e107_dirs : [];
$this->customDirsCache = array_diff_assoc($customDirs, $this->defaultDirsCache);
}
/**
* @param $path
* @return false|string
*/
private function relativePathToAbsolutePath($path)
{
return realpath(e_BASE . $path);
}
}

View File

@ -0,0 +1,95 @@
<?php
/**
* e107 website system
*
* Copyright (C) 2008-2020 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*/
interface e_file_inspector_interface
{
/**
* TRUE: All validations pass for the provided file.
* FALSE: One or more validations failed for the provided file.
*/
const VALIDATED = 1 << 0;
/**
* TRUE: The file path is known in this database, regardless of version.
* FALSE: The file path is not in this database.
*/
const VALIDATED_PATH_KNOWN = 1 << 1;
/**
* TRUE: The file path and specified version have a hash in this database.
* FALSE: There is no hash for the file path and specified version.
*/
const VALIDATED_PATH_VERSION = 1 << 2;
/**
* TRUE: The file exists.
* FALSE: The file doesn't exist.
*/
const VALIDATED_FILE_EXISTS = 1 << 3;
/**
* TRUE: The file's hash matches any known version.
* FALSE: The file's hash does not match any known versions.
*/
const VALIDATED_HASH_EXISTS = 1 << 4;
/**
* TRUE: The file's hash matches the specified version.
* FALSE: The file's hash matches a newer or older version than the one specified.
*/
const VALIDATED_HASH_CURRENT = 1 << 5;
/**
* TRUE: The file hash is calculable.
* FALSE: The file hash is not calculable (e.g. the core image itself, a user config file, a nonexistent file).
*/
const VALIDATED_HASH_CALCULABLE = 1 << 6;
/**
* TRUE: The file is not known to be insecure.
* FALSE: The file should be deleted due to security concerns.
*/
const VALIDATED_FILE_SECURITY = 1 << 7;
/**
* Return an Iterator that can enumerate every path in the image database
*
* @param $version string|null Provide a PHP-standardized version to limit the paths to that version
* @return Iterator
*/
public function getPathIterator($version = null);
/**
* Get all the known file integrity hashes for the provided path
*
* @param $path string Relative path of the file to look up
* @return array Associative array where the keys are the PHP-standardized versions and the values are the checksums
* for those versions.
*/
public function getChecksums($path);
/**
* List of versions of the provided path for which the database has hashes
*
* @param $path string Relative path of the file to look up
* @return array PHP-standardized versions. Empty if there are none.
*/
public function getVersions($path);
/**
* Get the version of the software that goes with this image database.
*
* This database SHOULD contain file integrity hashes for this software version.
* This database MAY contain file integrity hashes for older versions of this software.
*
* @return string PHP-standardized version
*/
public function getCurrentVersion();
/**
* Check if the file is insecure
*
* @param $path string Relative path of the file to look up
* @return bool TRUE if the file should be deleted due to known security flaws; FALSE otherwise
*/
public function isInsecure($path);
}

View File

@ -0,0 +1,99 @@
<?php
/**
* e107 website system
*
* Copyright (C) 2008-2020 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*/
require_once("e_file_inspector.php");
class e_file_inspector_json extends e_file_inspector
{
protected $coreImage;
/**
* @param $jsonFilePath string Absolute path to the file inspector database
*/
public function __construct($jsonFilePath = null)
{
parent::__construct($jsonFilePath);
}
/**
* @inheritDoc
*/
public function loadDatabase()
{
global $core_image;
@include($this->database);
$this->coreImage = json_decode($core_image, true);
if (!is_array($this->coreImage)) $this->coreImage = [];
$this->coreImage = self::array_slash($this->coreImage);
if (!$this->coreImage) $this->coreImage = [];
unset($core_image);
}
/**
* @inheritDoc
*/
public function getPathIterator($version = null)
{
$result = $this->coreImage;
if (!empty($version))
{
$result = array_filter($result, function ($value) use ($version)
{
return array_key_exists($version, $value);
});
}
return new ArrayIterator(array_keys($result));
}
/**
* @inheritDoc
*/
public function getChecksums($path)
{
$path = $this->customPathToDefaultPath($path);
return isset($this->coreImage[$path]) ? $this->coreImage[$path] : [];
}
/**
* Flatten a multi-dimensional associative array with slashes.
* Excludes the second-to-last level of depth from flattening.
* Also removes the leading "v" from all version keys.
*
* Based on Illuminate\Support\Arr::dot()
*
* @param array $array
* @param string $prepend
* @return array
* @copyright Copyright (c) Taylor Otwell
* @license https://github.com/illuminate/support/blob/master/LICENSE.md MIT License
*/
protected static function array_slash($array, $prepend = '')
{
$results = array();
foreach ($array as $key => $value)
{
if (is_array($value) && is_array(reset($value)))
{
$results = array_merge($results, self::array_slash($value, $prepend . $key . '/'));
}
else
{
foreach ($value as $versionWithV => $checksum)
{
$value[ltrim($versionWithV, 'v')] = $checksum;
unset($value[$versionWithV]);
}
$results[$prepend . $key] = $value;
}
}
return $results;
}
}

View File

@ -0,0 +1,53 @@
<?php
/**
* e107 website system
*
* Copyright (C) 2008-2020 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*/
require_once("e_file_inspector_json.php");
class e_file_inspector_json_phar extends e_file_inspector_json
{
/**
* @param $jsonPharFilePath string Absolute path to the file inspector database
*/
public function __construct($jsonPharFilePath = null)
{
parent::__construct($jsonPharFilePath);
}
/**
* @inheritDoc
*/
public function loadDatabase()
{
Phar::loadPhar($this->database, "core_image.phar");
$tmpFile = tmpfile();
$tmpFilePath = stream_get_meta_data($tmpFile)['uri'];
$this->copyUrlToResource("phar://core_image.phar/core_image.json", $tmpFile);
$this->coreImage = json_decode(file_get_contents($tmpFilePath), true);
if (!is_array($this->coreImage)) $this->coreImage = [];
$this->coreImage = self::array_slash($this->coreImage);
if (!$this->coreImage) $this->coreImage = [];
}
/**
* Copy file to destination with low memory footprint
* @param $source string URL of the source
* @param $destination resource File pointer of the destination
*/
private function copyUrlToResource($source, $destination)
{
$dbFile = fopen($source, "r");
while (!feof($dbFile))
{
$buffer = fread($dbFile, 4096);
fwrite($destination, $buffer);
}
unset($buffer);
fclose($dbFile);
}
}

View File

@ -0,0 +1,108 @@
<?php
/**
* e107 website system
*
* Copyright (C) 2008-2020 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*/
require_once("e_file_inspector.php");
class e_file_inspector_sqlphar extends e_file_inspector
{
private $coreImage;
/**
* @param $pharFilePath string Absolute path to the file inspector database
*/
public function __construct($pharFilePath = null)
{
parent::__construct($pharFilePath);
}
/**
* @inheritDoc
*/
public function loadDatabase()
{
Phar::loadPhar($this->database, "core_image.phar");
$tmpFile = tmpfile();
$tmpFilePath = stream_get_meta_data($tmpFile)['uri'];
$this->copyUrlToResource("phar://core_image.phar/core_image.sqlite", $tmpFile);
$this->coreImage = new PDO("sqlite:{$tmpFilePath}");
}
/**
* @inheritDoc
*/
public function getPathIterator($version = null)
{
$addVersionWhere = "";
$inputParameters = [];
if (!empty($version))
{
$addVersionWhere = "WHERE versions.version_string = ?";
$inputParameters[] = $version;
}
$statement = $this->coreImage->prepare("
SELECT path
FROM file_hashes
LEFT JOIN versions ON versions.version_id = file_hashes.release_version
$addVersionWhere
ORDER BY path ASC;
");
$statement->setFetchMode(PDO::FETCH_COLUMN, 0);
$statement->execute($inputParameters);
return new IteratorIterator($statement);
}
/**
* @inheritDoc
*/
public function getChecksums($path)
{
$path = $this->customPathToDefaultPath($path);
$statement = $this->coreImage->prepare("
SELECT versions.version_string, file_hashes.hash
FROM file_hashes
LEFT JOIN versions ON versions.version_id = file_hashes.release_version
WHERE file_hashes.path = :path
ORDER BY path ASC;
");
$statement->execute([
':path' => $path
]);
return $statement->fetchAll(PDO::FETCH_KEY_PAIR);
}
/**
* @inheritDoc
*/
public function getCurrentVersion()
{
if ($this->currentVersion) return $this->currentVersion;
$statement = $this->coreImage->query("
SELECT version_string FROM versions ORDER BY version_string DESC LIMIT 1
");
return $this->currentVersion = $statement->fetchColumn();
}
/**
* Copy file to destination with low memory footprint
* @param $source string URL of the source
* @param $destination resource File pointer of the destination
*/
private function copyUrlToResource($source, $destination)
{
$dbFile = fopen($source, "r");
while (!feof($dbFile))
{
$buffer = fread($dbFile, 4096);
fwrite($destination, $buffer);
}
unset($buffer);
fclose($dbFile);
}
}

View File

@ -0,0 +1,105 @@
<?php
/**
* e107 website system
*
* Copyright (C) 2008-2020 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*/
class e_file_inspectorTest extends \Codeception\Test\Unit
{
/**
* @var e_file_inspector_sqlphar
*/
private $e_integrity;
public function _before()
{
require_once(e_HANDLER . "e_file_inspector_json_phar.php");
// TODO: Make test databases; don't hard-code e107_admin/core_image.php and hope it has the expected content.
$this->e_integrity = new e_file_inspector_json_phar(e_ADMIN . "core_image.php");
}
public function testGetChecksums()
{
$checksums = $this->e_integrity->getChecksums("e107_admin/e107_update.php");
$this->assertIsArray($checksums);
$this->assertNotEmpty($checksums);
$checksums = $this->e_integrity->getChecksums("e107_handlers/nonexistent.php");
$this->assertIsArray($checksums);
$this->assertEmpty($checksums);
}
public function testGetCurrentVersion()
{
$actualVersion = $this->e_integrity->getCurrentVersion();
$this->assertIsString($actualVersion);
$this->assertNotEmpty($actualVersion);
}
public function testGetPathIterator()
{
$iterator = $this->e_integrity->getPathIterator();
$this->assertGreaterThanOrEqual(1, iterator_count($iterator));
$iterator = $this->e_integrity->getPathIterator("0.0.1-fakeNonExistentVersion");
$this->assertEquals(0, iterator_count($iterator));
}
public function testValidate()
{
$result = $this->e_integrity->validate("index.php");
$this->assertGreaterThanOrEqual(1, $result & e_file_inspector::VALIDATED);
$this->assertGreaterThanOrEqual(1, $result & e_file_inspector::VALIDATED_PATH_KNOWN);
$this->assertGreaterThanOrEqual(1, $result & e_file_inspector::VALIDATED_PATH_VERSION);
$this->assertGreaterThanOrEqual(1, $result & e_file_inspector::VALIDATED_FILE_EXISTS);
$this->assertGreaterThanOrEqual(1, $result & e_file_inspector::VALIDATED_HASH_EXISTS);
$this->assertGreaterThanOrEqual(1, $result & e_file_inspector::VALIDATED_HASH_CURRENT);
$this->assertGreaterThanOrEqual(1, $result & e_file_inspector::VALIDATED_HASH_CALCULABLE);
$this->assertGreaterThanOrEqual(1, $result & e_file_inspector::VALIDATED_FILE_SECURITY);
$result = $this->e_integrity->validate("file/does/not/exist.php");
$this->assertEquals(0, $result & e_file_inspector::VALIDATED_FILE_EXISTS);
}
public function testCustomPathToDefaultPath()
{
/** @var e_file_inspector $object */
$object = $this->make('e_file_inspector');
$class = new ReflectionClass(get_class($object));
$object->customPathToDefaultPath('populate_cache');
$member = $class->getProperty('customDirsCache');
$member->setAccessible(true);
$customDirs = $member->getValue($object);
$customDirs['ADMIN_DIRECTORY'] = 'e963_admin/';
$member->setValue($object, $customDirs);
$input = "e963_admin/index.php";
$expected = "e107_admin/index.php";
$actual = $object->customPathToDefaultPath($input);
$this->assertEquals($expected, $actual);
}
public function testDefaultPathToCustomPath()
{
/** @var e_file_inspector $object */
$object = $this->make('e_file_inspector');
$class = new ReflectionClass(get_class($object));
$object->customPathToDefaultPath('populate_cache');
$member = $class->getProperty('customDirsCache');
$member->setAccessible(true);
$customDirs = $member->getValue($object);
$customDirs['ADMIN_DIRECTORY'] = 'e963_admin/';
$member->setValue($object, $customDirs);
$input = "e107_admin/index.php";
$expected = "e963_admin/index.php";
$actual = $object->defaultPathToCustomPath($input);
$this->assertEquals($expected, $actual);
}
}